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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Dec 22 15:46:31 CET 2011


Author: torsten
Date: 2011-12-22 15:46:30 +0100 (Thu, 22 Dec 2011)
New Revision: 5737

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
Add convinient function to set the maximum reachable phase of a case.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-12-22 14:44:25 UTC (rev 5736)
+++ base/trunk/mpulsweb/model/case.py	2011-12-22 14:46:30 UTC (rev 5737)
@@ -913,6 +913,14 @@
     def getPhase(self):
         return self.getState().getPhase()
 
+    def set_reachable_phase(self):
+        """Will set the maximum reachable phase of the case"""
+        phases = self.get_phaseslist()
+        current_phase = phases.get_current_phase_id()
+        reachable_phase = phases.get_max_phase_id()
+        if current_phase != reachable_phase:
+            self.setPhase(reachable_phase)
+
     def setPhase(self, phase):
         r = self.getState().setPhase(phase)
         self.checkValidity()



More information about the Mpuls-commits mailing list