[Lada-commits] [PATCH] Update "fertig" flag on status changes

Wald Commits scm-commit at wald.intevation.org
Mon Dec 14 11:07:53 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1450087660 -3600
# Branch statusworkflow
# Node ID c3cf7cbb65ed61553123117ecc098efa4bc867bd
# Parent  487c6d8c9d7bb8af6cf75e1f21ae542f149d5da9
Update "fertig" flag on status changes.

diff -r 487c6d8c9d7b -r c3cf7cbb65ed src/main/java/de/intevation/lada/rest/StatusService.java
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Wed Dec 09 16:51:31 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Mon Dec 14 11:07:40 2015 +0100
@@ -262,9 +262,13 @@
             }
             if ((change || next) && status.getStatusWert() == 4) {
                 status.setStatusStufe(1);
+                messung.setFertig(false);
             }
             else if (change) {
                 status.setStatusStufe(currentStatus.getStatusStufe());
+                if (status.getStatusStufe() == 1) {
+                    messung.setFertig(true);
+                }
             }
             else if (next) {
                 status.setStatusStufe(currentStatus.getStatusStufe() + 1);
@@ -358,9 +362,25 @@
             lastFilter.orderBy("datum", false);
             List<LStatusProtokoll> protos =
                 defaultRepo.filterPlain(lastFilter.getQuery(), "land");
-            messung.setStatus(protos.get(protos.size() - 3).getId());
+            LStatusProtokoll prev;
+            if (protos.size() < 3) {
+                prev = created;
+            }
+            else {
+                prev = protos.get(protos.size() - 3);
+            }
+            if (prev.getStatusStufe() == 1 &&
+                prev.getStatusWert() != 0 &&
+                prev.getStatusWert( != 4) {
+                messung.setFertig(true);
+            }
+            messung.setStatus(prev.getId());
         }
         else {
+            if (created.getStatusStufe() == 1 &&
+                created.getStatusWert() == 4) {
+                messung.setFertig(false);
+            }
             messung.setStatus(created.getId());
         }
 


More information about the Lada-commits mailing list