[Lada-commits] [PATCH] There are only two clear-cut cases where 'fertig' should be set

Wald Commits scm-commit at wald.intevation.org
Mon Feb 15 12:02:14 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1455534114 -3600
# Node ID e09c41d8eef30759ea47ff43a658c2a1a14055d2
# Parent  fa7278bd8d7368134165c523ef5166032105f54a
There are only two clear-cut cases where 'fertig' should be set.

diff -r fa7278bd8d73 -r e09c41d8eef3 src/main/java/de/intevation/lada/rest/StatusService.java
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Mon Feb 15 11:33:44 2016 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Mon Feb 15 12:01:54 2016 +0100
@@ -293,7 +293,6 @@
                     status.getStatusStufe() > 1
                 ) {
                     status.setStatusStufe(currentStatus.getStatusStufe());
-                    messung.setFertig(false);
                 }
                 else if (change && status.getStatusWert() == 8) {
                     return authorization.filter(
@@ -303,22 +302,24 @@
                 }
                 else if (change && status.getStatusWert() != 0) {
                     status.setStatusStufe(currentStatus.getStatusStufe());
-                    if (status.getStatusStufe() == 1) {
-                        messung.setFertig(true);
-                    }
                 }
                 else if (next &&
                     (status.getStatusWert() > 0 &&
                      status.getStatusWert() <= 4 ||
                      status.getStatusWert() == 7)) {
                     status.setStatusStufe(currentStatus.getStatusStufe() + 1);
-                    if (status.getStatusWert() == 4) {
-                        messung.setFertig(false);
-                    }
                 }
                 else {
                     return new Response(false, 699, null);
                 }
+
+                // auto-set 'fertig'-flag
+                if (status.getStatusStufe() == 1) {
+                    messung.setFertig(true);
+                }
+                else if (status.getStatusWert() == 4) {
+                    messung.setFertig(false);
+                }
             }
         }
         Violation violation = validator.validate(status);
@@ -435,7 +436,6 @@
             nV.setText("");
             retValue = defaultRepo.create(nV, "land");
             messung.setStatus(((LStatusProtokoll)retValue.getData()).getId());
-            messung.setFertig(false);
         }
         else {
             QueryBuilder<LStatusProtokoll> lastFilter =


More information about the Lada-commits mailing list