BP-833, fix using wrong duration for ending a phase
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
index 35aa8c4..c60f9bf 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
@@ -232,7 +232,7 @@
StandbyDuration tmpDur = this.getNextDurationWithMaChange(group, endOfDuration);
if (tmpDur != null) {
differenceOfDays = DateHelper.calculateDifferenceOfDays(
- DateHelper.getDayOfWeek(endOfDuration), tmpDur.getValidDayTo(), endOfDuration,
+ DateHelper.getDayOfWeek(startOfDuration), tmpDur.getValidDayTo(), startOfDuration,
tmpDur.getValidTo());
endOfDuration = DateHelper.addDaysToDate(tmpDate, differenceOfDays);
endOfDuration = DateHelper.getDateWithTime(endOfDuration, tmpDur.getValidTo());
@@ -286,10 +286,10 @@
* @return
*/
public StandbyDuration getNextDurationWithMaChange(StandbyGroup group, Date date) {
- for (int i = 0; i <= 7; i++) {
- List<StandbyDuration> lsDuration = this.getFittingDurationsOfGroup(group, date);
+ for (int i = 0; i <= 6; i++) {
+ List<StandbyDuration> lsDuration = this.getFittingDurationsByValidTo(group, date);
for (StandbyDuration stbDur : lsDuration) {
- if (stbDur.getNextUserInNextDuration() == true) {
+ if (stbDur.getNextUserInNextDuration()) {
return stbDur;
}
}