[Mpuls-commits] r141 - in waska/trunk: . waskaweb/controllers waskaweb/model waskaweb/templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Sep 8 17:35:02 CEST 2008
Author: torsten
Date: 2008-09-08 17:35:01 +0200 (Mon, 08 Sep 2008)
New Revision: 141
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/controllers/case_overview.py
waska/trunk/waskaweb/controllers/waska.py
waska/trunk/waskaweb/model/phase_transition.py
waska/trunk/waskaweb/model/phases_factory.py
waska/trunk/waskaweb/templates/casemanagement/listbadcases.mako
Log:
Further improved inconsestency checks
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/ChangeLog.txt 2008-09-08 15:35:01 UTC (rev 141)
@@ -20,6 +20,16 @@
checks for missing fields in a particular phase. Furter refactored
the listing a the inconsistent cases.
+ Further improved inconsestency checks
+
+ * waskaweb/model/phases_factory.py,
+ waskaweb/model/phase_transition.py,
+ waskaweb/controllers/case_overview.py,
+ waskaweb/controllers/waska.py,
+ waskaweb/templates/casemanagement/listbadcases.mako: Ignore checks
+ on inkonsistent phases for cases which are older than 01.09.2008.
+ Further only check inconsistency on current phase.
+
2008-09-08 Sascha L. Teichmann <sascha.teichmann at intevation.de>
* waskaweb/model/navigation.py: add method findTreeItem().
Modified: waska/trunk/waskaweb/controllers/case_overview.py
===================================================================
--- waska/trunk/waskaweb/controllers/case_overview.py 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/waskaweb/controllers/case_overview.py 2008-09-08 15:35:01 UTC (rev 141)
@@ -303,9 +303,14 @@
def listBadCases(self):
user = session.get('USER_AUTHORIZED')
c.inconsistency_types = {}
+ rexpr_phases = re.compile('.*_[start|ende]')
try:
for k,v in build_inconsistency_type_querys().iteritems():
- s = 'state:1;state:2;state:4;state:5;own:%s;inconsistency:%s' % (user.id, k)
+ # igonore checks on phases for old cases
+ if rexpr_phases.match(k):
+ s = "state:1;state:2;own:%s;interval_start_date:'2008-09-01';interval_end_date:'2011-09-01';inconsistency:%s" % (user.id, k)
+ else:
+ s = 'state:1;state:2;state:4;state:5;own:%s;inconsistency:%s' % (user.id, k)
l = CaseOverview().search(s)
c.inconsistency_types[k] = l
except StandardError, err:
Modified: waska/trunk/waskaweb/controllers/waska.py
===================================================================
--- waska/trunk/waskaweb/controllers/waska.py 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/waskaweb/controllers/waska.py 2008-09-08 15:35:01 UTC (rev 141)
@@ -86,8 +86,18 @@
c.news = NewsList(user)
#find out if there are cases with errors
- search_str = "state:1;state:2;state:3;state:4;state:5;bad:1;bad:2;bad:3;bad:4;bad:5;bad:6;bad:clearing_start;bad:clearing_ende;bad:beratung_start;bad:beratung_ende;bad:cm_start;bad:cm_ende;bad:nachbetreuung_start;bad:nachbetreuung_ende;own:%s" % user.id
- c.num_error_cases = len(CaseOverview().search(search_str))
+
+ #Search inconsistencys on dates
+ search_str1 = "state:1;state:2;state:4;state:5;bad:1;bad:2;bad:3;bad:4;bad:5;bad:6;bad:clearing_start;bad:clearing_ende;bad:beratung_start;bad:beratung_ende;bad:cm_start;bad:cm_ende;bad:nachbetreuung_start;bad:nachbetreuung_ende;own:%s" % user.id
+
+ #Search inconsistencys on phases but ignore older cases.
+ search_str2 = "state:1;state:2;state:4;bad:clearing_start;bad:clearing_ende;bad:beratung_start;bad:beratung_ende;bad:cm_start;bad:cm_ende;bad:nachbetreuung_start;bad:nachbetreuung_ende;interval_start_date:'2008-09-01';interval_end_date:'2011-09-01';own:%s" % user.id
+
+ num_error_cases1 = len(CaseOverview().search(search_str1))
+ num_error_cases2 = len(CaseOverview().search(search_str2))
+
+ c.num_error_cases = max(num_error_cases1, num_error_cases2)
+
if c.num_error_cases > 0:
session['hascaseerrors'] = True
else:
Modified: waska/trunk/waskaweb/model/phase_transition.py
===================================================================
--- waska/trunk/waskaweb/model/phase_transition.py 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/waskaweb/model/phase_transition.py 2008-09-08 15:35:01 UTC (rev 141)
@@ -105,6 +105,14 @@
preds.add(k)
return list(preds)
+def phase_predecessors_path(phase, path=None):
+ if not path:
+ path = []
+ for p in phase_predecessors(phase):
+ path.append(p)
+ phase_predecessors_path(p, path)
+ return path
+
def phase_neighbors(phase1, phase2):
try:
return phase2 in PHASE_SUCCESSORS[phase1] or phase1 in PHASE_SUCCESSORS[phase2]
Modified: waska/trunk/waskaweb/model/phases_factory.py
===================================================================
--- waska/trunk/waskaweb/model/phases_factory.py 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/waskaweb/model/phases_factory.py 2008-09-08 15:35:01 UTC (rev 141)
@@ -39,6 +39,12 @@
OR %(name)s != get_default_value('master_tbl', '%(name)s')))
"""
+IS_NOT_FILLED = \
+"""((NOT (%(name)s IS NOT NULL
+ AND (get_default_value('master_tbl', '%(name)s') IS NULL
+ OR %(name)s != get_default_value('master_tbl', '%(name)s')))) AND phase = %(phase)s)
+"""
+
SELECT = \
''' SELECT %s FROM master_tbl_view WHERE id = %%(id)s
'''
@@ -157,7 +163,8 @@
""" returns list of tuples (<symbol of phase>, <sql where clause>) """
clauses = []
for k, v in self.phases.iteritems():
- where = " OR ".join(['(NOT %s)' % IS_FILLED % { 'name': name } for name in [i[0].getName() for i in v]])
+ # There where clause will return cases with inconsistencies for their current phase
+ where = " OR ".join([IS_NOT_FILLED % { 'name': name, 'phase':SYMBOLS_PHASE.get(k)} for name in [i[0].getName() for i in v]])
clauses.append((k, where))
return clauses
Modified: waska/trunk/waskaweb/templates/casemanagement/listbadcases.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/listbadcases.mako 2008-09-08 15:27:40 UTC (rev 140)
+++ waska/trunk/waskaweb/templates/casemanagement/listbadcases.mako 2008-09-08 15:35:01 UTC (rev 141)
@@ -15,6 +15,10 @@
'cm_ende':u'Fehlende Pflichtfeldangaben für die Beendigung der "Case-Management" Phase',
'nachbetreuung_start':u'Fehlende Pflichtfeldangaben für den Start der "Nachbetreuungs" Phase',
'nachbetreuung_ende':u'Fehlende Pflichtfeldangaben für die Beendigung der "Nachbetreuungs'}
+ # ignore search of inconsistent cases which do not intersect with the given
+ # timeframe (filter out old cases)
+ start_date = '2008-09-01'
+ end_date = '2011-09-01'
%>
<%inherit file="../main.mako" />
<div>
@@ -28,7 +32,7 @@
<th style="width:4em;text-align:right">Anzahl</th>
<th style="width:7em;text-align:right">Aktion</th>
</tr>
- <% count = 1 %>
+ <% import re; count = 1; regexpr = re.compile('.*[start|ende]') %>
%for k, v in c.inconsistency_types.iteritems():
%if len(v) > 0:
<tr>
@@ -39,7 +43,11 @@
<input type="hidden" name="show_anonymized" value="1">
<input type="hidden" name="show_own" value="1">
<input type="hidden" name="show_open" value="1">
- <input type="hidden" name="search_str" value="inconsistency:${k}">
+ % if regexpr.match(k):
+ <input type="hidden" name="search_str" value="inconsistency:${k};interval_start_date:'${start_date}';interval_end_date:'${end_date}'">
+ % else:
+ <input type="hidden" name="search_str" value="inconsistency:${k}">
+ % endif
<input type="submit" value="Anzeigen">
</form>
</td>
More information about the Mpuls-commits
mailing list