From e86640ea4208e85cda4bf17e17d467d1db510443 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Fri, 12 Jun 2015 11:32:37 +0700 Subject: [PATCH] xxx --- netforce_clinic/models/report_cycle_setting.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/models/report_cycle_setting.py b/netforce_clinic/models/report_cycle_setting.py index 5dd0c52..f35239a 100644 --- a/netforce_clinic/models/report_cycle_setting.py +++ b/netforce_clinic/models/report_cycle_setting.py @@ -128,7 +128,6 @@ class ReportCycleSetting(Model): pts[key]['sun_cycle_id']=cycle.name lines=[] - no=1 for k, vals in pts.items(): pt_id, dpt_id=k if pt_id: @@ -138,12 +137,17 @@ class ReportCycleSetting(Model): dpt_id=pt.department_id.id if dpt_id: vals['department_id']=dpt_id - vals['no']=no lines.append(vals) - no+=1 + no=1 + nlines=[] + for line in sorted(lines,key=lambda x:x['patient_name']): + line['no']=no + nlines.append(line) + no+=1 + data={ - 'lines': lines, + 'lines': nlines, 'department_id': department_id, } return data