[Mpuls-commits] r5532 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 3 11:17:59 CET 2011


Author: ludwig
Date: 2011-11-03 11:17:56 +0100 (Thu, 03 Nov 2011)
New Revision: 5532

Modified:
   base/trunk/mpulsweb/model/appointment.py
Log:
Issue 2606: Improvement to the MaxSaveTimeReminderOverview class.
Now the expensiv Agency._fetchData is done just one time.


Modified: base/trunk/mpulsweb/model/appointment.py
===================================================================
--- base/trunk/mpulsweb/model/appointment.py	2011-11-03 09:42:35 UTC (rev 5531)
+++ base/trunk/mpulsweb/model/appointment.py	2011-11-03 10:17:56 UTC (rev 5532)
@@ -599,8 +599,10 @@
         # longer than maxage.
         # orphaned means that all last appointments, aids or the
         # modification date is older than maxage
-        oldAndActive = self.getOldAndActiveCases(maxage, user)
-        oldAndFinished = self.getOldAndFinishedCases(maxage, user)
+        oldAndActive = self.getOldAndActiveCases(maxage, user, 
+                                                 agency.getReminderCondition())
+        oldAndFinished = self.getOldAndFinishedCases(maxage, user, 
+                                            agency.getReminderCondition())
 
         # 1. Load the user's cases so we can check the maximum savetime on them
         default_search_options = ['own:%s' % user.id, 'standin:%s' % user.id,
@@ -635,10 +637,9 @@
                                                  finished=True)
             self.appointment_list.append(appointment)
 
-    def getOldAndFinishedCases(self, days, user):
+    def getOldAndFinishedCases(self, days, user, remindercondition):
         conn, cur = None, None
         list = {}
-        remindercondition = Agency().getReminderCondition()
         try:
             conn = db.getConnection()
             cur = conn.cursor()
@@ -659,10 +660,9 @@
             db.recycleConnection(conn, cur)
         return False
 
-    def getOldAndActiveCases(self, days, user):
+    def getOldAndActiveCases(self, days, user, remindercondition):
         conn, cur = None, None
         list = {}
-        remindercondition = Agency().getReminderCondition()
         try:
             conn = db.getConnection()
             cur = conn.cursor()



More information about the Mpuls-commits mailing list