[Mpuls-commits] r122 - in waska/trunk: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 3 12:38:23 CEST 2008


Author: teichmann
Date: 2008-09-03 12:38:22 +0200 (Wed, 03 Sep 2008)
New Revision: 122

Added:
   waska/trunk/waskaweb/model/phase_transition.py
Modified:
   waska/trunk/ChangeLog.txt
Log:
Added phase transition table.


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-03 10:13:06 UTC (rev 121)
+++ waska/trunk/ChangeLog.txt	2008-09-03 10:38:22 UTC (rev 122)
@@ -1,5 +1,10 @@
 2008-09-03  Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
+	* waskaweb/model/phase_transition.py: New. Transition table for phase model.
+	  Contains descption strings for phases, too.
+
+2008-09-03  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
 	* formed/formedtree_web.xml: Synced with database.
 
 2008-09-03	Torsten Irlaender  <torsten.irlaender at intevation.de>

Added: waska/trunk/waskaweb/model/phase_transition.py
===================================================================
--- waska/trunk/waskaweb/model/phase_transition.py	2008-09-03 10:13:06 UTC (rev 121)
+++ waska/trunk/waskaweb/model/phase_transition.py	2008-09-03 10:38:22 UTC (rev 122)
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
+# 
+# This file is part of mpuls WASKA (CoMPUter-based case fiLeS - 
+# Web-Anwendungs-Server fuer Kompetenzagenturen).
+# 
+# mpuls WASKA is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+# 
+# mpuls WASKA is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
+# License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public
+# License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
+# 
+# mpuls WASKA has been developed on behalf of the 
+# Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
+# within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
+# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and 
+# European Social Fund resources.
+#
+# Authors:
+# Sascha L. Teichmann <sascha.teichmann at intevation.de>
+#
+
+UNKNOWN        = -1
+CLEAR_START    =  0
+CLEAR_ENDE     =  1
+CM_START       =  2
+CM_ENDE        =  3
+NB_START       =  4
+NB_ENDE        =  5
+BERATUNG_START =  6
+BERATUNG_ENDE  =  7
+
+PHASE_DESCRIPTIONS = {
+    UNKNOWN        : u"Unbekannt",
+    CLEAR_START    : u"Clearing läuft",
+    CLEAR_ENDE     : u"Clearing beendet",
+    CM_START       : u"Case-Management läuft",
+    CM_ENDE        : u"Case-Management beendet",
+    NB_START       : u"Nachbetreuung läuft",
+    NB_ENDE        : u"Nachbetreuung beendet",
+    BERATUNG_START : u"Beratung läuft",
+    BERATUNG_ENDE  : u"Beratung beendet"
+}
+
+PHASE_SUCCESSORS = {
+    UNKNOWN       : [CLEAR_START],
+    CLEAR_START   : [CLEAR_ENDE],
+    CLEAR_ENDE    : [CM_START, BERATUNG_START],
+    CM_START      : [CM_ENDE],
+    BERATUNG_START: [BERATUNG_ENDE],
+    BERATUNG_ENDE : [],
+    CM_ENDE       : [NB_START],
+    NB_ENDE       : []
+}
+
+def phase_description(phase):
+    return PHASE_DESCRIPTIONS.get(phase, "-/-")
+
+def phase_successors(phase):
+    try:
+        return PHASE_SUCCESSORS[phase]
+    except KeyError:
+        return []
+
+def phase_predecessors(phase):
+    preds = set()
+    for k, v in PHASE_SUCCESSORS.iteritems():
+        if phase in v:
+            preds.add(k)
+    return list(preds)
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:



More information about the Mpuls-commits mailing list