Skip to content
Snippets Groups Projects
Commit 3ad1e98d authored by Dominik Pilár's avatar Dominik Pilár
Browse files

Merge branch 'fix-get-fulfilled-method' into 'master'

Get fulfilled method fixed.

See merge request !53
parents 2b0aad40 562c4963
No related branches found
No related tags found
1 merge request!53Get fulfilled method fixed.
Pipeline #89717 passed with stages
in 2 minutes and 40 seconds
......@@ -39,6 +39,7 @@ import java.time.Clock;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -268,7 +269,9 @@ public class TrainingRunService {
List<Long> trainingPhasesIds = orderedTrainingPhases.stream()
.map(AbstractPhase::getId)
.collect(Collectors.toList());
List<TrainingPhaseQuestionsFulfillment> questionnairesFulfillment = this.trainingPhaseQuestionsFulfillmentRepository.findByTrainingPhasesAndTrainingRun(trainingPhasesIds, trainingRunId);
Map<Integer, TrainingPhaseQuestionsFulfillment> questionnairesFulfillment = this.trainingPhaseQuestionsFulfillmentRepository.findByTrainingPhasesAndTrainingRun(trainingPhasesIds, trainingRunId)
.stream()
.collect(Collectors.toMap(fulfillment -> trainingPhasesIds.indexOf(fulfillment.getTrainingPhase().getId()), Function.identity()));
return decisionMatrixRows.stream().map(row -> {
DecisionMatrixRowForAssistantDTO decisionMatrixRowForAssistantDTO = new DecisionMatrixRowForAssistantDTO();
......@@ -286,10 +289,9 @@ public class TrainingRunService {
}).collect(Collectors.toList());
}
private boolean getFulfilled(List<TrainingPhaseQuestionsFulfillment> questionnairesFulfillment, int order){
if (questionnairesFulfillment.isEmpty())
return true;
return questionnairesFulfillment.get(order).isFulfilled();
private boolean getFulfilled(Map<Integer, TrainingPhaseQuestionsFulfillment> questionnairesFulfillment, int order){
TrainingPhaseQuestionsFulfillment fulfillment = questionnairesFulfillment.get(order);
return fulfillment == null || fulfillment.isFulfilled();
}
private RelatedPhaseInfoDTO getPhaseInfo(AbstractPhase abstractPhase, Boolean trainingPhaseQuestionsFulfillment) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment