Mercurial > lada > lada-server
changeset 822:c3cf7cbb65ed statusworkflow
Update "fertig" flag on status changes.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 14 Dec 2015 11:07:40 +0100 |
parents | 487c6d8c9d7b |
children | de3a26d3f663 |
files | src/main/java/de/intevation/lada/rest/StatusService.java |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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()); }