[Mpuls-commits] r173 - in waska/trunk: . waskaweb/controllers waskaweb/model waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 18 16:47:04 CEST 2008


Author: teichmann
Date: 2008-09-18 16:47:03 +0200 (Thu, 18 Sep 2008)
New Revision: 173

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/case.py
   waska/trunk/waskaweb/model/case.py
   waska/trunk/waskaweb/templates/casemanagement/phase.mako
Log:
Fixed problem with setting phases with old cases.


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-18 12:32:57 UTC (rev 172)
+++ waska/trunk/ChangeLog.txt	2008-09-18 14:47:03 UTC (rev 173)
@@ -1,3 +1,11 @@
+2008-09-18  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
+	* waskaweb/templates/casemanagement/phase.mako,
+	  waskaweb/controllers/case.py: Renamed isOlderThan() to isYoungerThan()
+	  because of inverted usage.
+
+	* waskaweb/model/case.py: Fixed problem witch are too old for phase model.
+
 2008-09-18	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	Fixed phases in evaluation

Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py	2008-09-18 12:32:57 UTC (rev 172)
+++ waska/trunk/waskaweb/controllers/case.py	2008-09-18 14:47:03 UTC (rev 173)
@@ -737,7 +737,7 @@
                         pass
 
                 if new_phase is None:
-                    raise Error("Phase nicht gefunden.")
+                    raise StandardError("Phase nicht gefunden.")
 
                 state = case.getState()
 
@@ -746,13 +746,15 @@
                 #if not phase_neighbors(current_phase, new_phase):
                 #    raise StandardError("Phasen sind nicht benachbart.")
 
-                fields = case.getRequiredFields()
-                if not fields.isPhaseComplete(new_phase_symbol):
-                    raise StandardError("Phase ist nicht komplett.")
+                case_session = session.get('case')
 
+                if case_session.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
+                    fields = case.getRequiredFields()
+                    if not fields.isPhaseComplete(new_phase_symbol):
+                        raise StandardError("Phase ist nicht komplett.")
+
                 state.setPhase(new_phase)
 
-                case_session = session.get('case')
                 case_session.state = state
                 session.save()
 
@@ -1262,7 +1264,7 @@
             case = load_case(id)
             # Check if the case is in a consistent state (all required fields
             # are filled)
-            if not case.getState().phasesAreConsistent() and case.isOlderThan(INCONSISTENCY_CHECK_AFTER):
+            if not case.getState().phasesAreConsistent() and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
                 c.notification_for  = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED 
                 c.notification_text = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
                 c.url_ok            = h.url_for(controller="/case_overview")
@@ -1293,7 +1295,7 @@
             c.form_navigation = self._getFormNavigation()
             # Check if the case is in a consistent state (all required fields
             # are filled)
-            if not case.getState().phasesAreConsistent() and case.isOlderThan(INCONSISTENCY_CHECK_AFTER):
+            if not case.getState().phasesAreConsistent() and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
                 c.notification_for  = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED 
                 c.notification_text = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
                 c.url_ok            = "/case/digest/%s" % id

Modified: waska/trunk/waskaweb/model/case.py
===================================================================
--- waska/trunk/waskaweb/model/case.py	2008-09-18 12:32:57 UTC (rev 172)
+++ waska/trunk/waskaweb/model/case.py	2008-09-18 14:47:03 UTC (rev 173)
@@ -791,7 +791,7 @@
     def getFirstMeeting(self):
         return self.first_name
 
-    def isOlderThan(self, mydate):
+    def isYoungerThan(self, mydate):
         y,m,d = mydate.split('-')
         if self.first_meeting:
             older = self.first_meeting > date(int(y), int(m), int(d))

Modified: waska/trunk/waskaweb/templates/casemanagement/phase.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-18 12:32:57 UTC (rev 172)
+++ waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-18 14:47:03 UTC (rev 173)
@@ -39,7 +39,7 @@
       </td>
       <td>${h.dd_mm_YYYY(p1.getTime(), '-/-')}</td>
       <td style="text-align:right">
-        % if (p1.isRecursiveComplete() and not p1.isRunning() and (p1.isNeighbor(c.current_phase) or c.current_phase.hasPredecessor(p1))) or not session.get('case').isOlderThan('2008-09-01'):
+        % if (p1.isRecursiveComplete() and not p1.isRunning() and (p1.isNeighbor(c.current_phase) or c.current_phase.hasPredecessor(p1))) or not session.get('case').isYoungerThan('2008-09-01'):
             <input type="submit" value="Start" name="${p1.getLabel()|h}">
         % else:
             <input type="submit" value="Start" name="${p1.getLabel()|h}"
@@ -58,7 +58,7 @@
       </td>
       <td class="table_row_h">${h.dd_mm_YYYY(p2.getTime(), '-/-')}</td>
       <td style="text-align:right" class="table_row_h">
-        % if (p2.isRecursiveComplete() and p2.isNeighbor(c.current_phase) and not c.current_phase.hasPredecessor(p2)) or not session.get('case').isOlderThan('2008-09-01'):
+        % if (p2.isRecursiveComplete() and p2.isNeighbor(c.current_phase) and not c.current_phase.hasPredecessor(p2)) or not session.get('case').isYoungerThan('2008-09-01'):
             <input type="submit" value="Ende" name="${p2.getLabel()|h}">
         % else:
             <input type="submit" value="Ende" name="${p2.getLabel()|h}" 



More information about the Mpuls-commits mailing list