[Mpuls-commits] r3361 - wasko/trunk/waskoweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 10 16:31:12 CEST 2010


Author: roland
Date: 2010-08-10 16:31:11 +0200 (Tue, 10 Aug 2010)
New Revision: 3361

Modified:
   wasko/trunk/waskoweb/controllers/formularpage.py
Log:
simplify some logic

Modified: wasko/trunk/waskoweb/controllers/formularpage.py
===================================================================
--- wasko/trunk/waskoweb/controllers/formularpage.py	2010-08-10 14:06:37 UTC (rev 3360)
+++ wasko/trunk/waskoweb/controllers/formularpage.py	2010-08-10 14:31:11 UTC (rev 3361)
@@ -171,24 +171,18 @@
                             FROM master_tbl_view
                             WHERE id = %s''' % (case_id))
             case_data = cur.fetchall()[0]
-            dates = [date for date in case_data[:3] if date != None]
-            if dates:
-                max_date = max([date for date in case_data[:3] if date != None])
-                date_extension_1 = case_data[2]
-                date_extension_2 = case_data[3]
-                first_date = case_data[0]
-            else:
-                first_date = max_date = datetime.date.today()
-                date_extension_1 = date_extension_2 = datetime.date.today()
-            time_delta = max_date - first_date
             
+            # log.debug('case_data: %s' % case_data)
+            #max([date for date in case_data[:3] if date != None])
+            date_extension_1 = case_data[2]
+            date_extension_2 = case_data[3]
+            first_date = case_data[0] or datetime.date.today()
+            
             # Maximum of 18 months with 2 extensions
-            if (date_extension_1 != None and date_extension_2 != None
-                and time_delta.days > 18*31):
+            if (date_extension_1 != None and date_extension_2 != None):
                 max_time_delta = datetime.timedelta(18*31)
-            # Maximum of 15 months with 1 extensions
-            elif (date_extension_1 != None and date_extension_2 == None
-                and time_delta.days > 15*31):
+            # Maximum of 15 months with 1 extension
+            elif (date_extension_1 != None and date_extension_2 == None):
                 max_time_delta = datetime.timedelta(15*31)
             # Everything else, 12 months
             else:



More information about the Mpuls-commits mailing list