Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kypo-adaptive-training
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNI-KYPO-CRP
backend-java
kypo-adaptive-training
Commits
ec7606c0
Commit
ec7606c0
authored
4 years ago
by
Jan Tymel
Browse files
Options
Downloads
Patches
Plain Diff
Fix DecisionMatrixRows alignment when phases' order are changed
Related to
#1
parent
5e76cf20
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/example/demo/service/PhaseLevelService.java
+9
-7
9 additions, 7 deletions
...main/java/com/example/demo/service/PhaseLevelService.java
with
9 additions
and
7 deletions
src/main/java/com/example/demo/service/PhaseLevelService.java
+
9
−
7
View file @
ec7606c0
...
...
@@ -69,8 +69,10 @@ public class PhaseLevelService {
public
void
alignDecisionMatrixForPhasesInTrainingDefinition
(
Long
trainingDefinitionId
)
{
List
<
PhaseLevel
>
phaseLevels
=
phaseLevelRepository
.
findAllByTrainingDefinitionIdOrderByOrder
(
trainingDefinitionId
);
int
currentPhaseOrder
=
0
;
for
(
PhaseLevel
phaseLevel
:
phaseLevels
)
{
alignDecisionMatrixForPhase
(
phaseLevel
);
alignDecisionMatrixForPhase
(
phaseLevel
,
currentPhaseOrder
);
currentPhaseOrder
++;
}
}
...
...
@@ -91,7 +93,7 @@ public class PhaseLevelService {
return
result
;
}
private
void
alignDecisionMatrixForPhase
(
PhaseLevel
phaseLevel
)
{
private
void
alignDecisionMatrixForPhase
(
PhaseLevel
phaseLevel
,
int
currentPhaseOrder
)
{
if
(
Objects
.
isNull
(
phaseLevel
))
{
return
;
}
...
...
@@ -101,15 +103,15 @@ public class PhaseLevelService {
numberOfRows
=
phaseLevel
.
getDecisionMatrix
().
size
();
}
final
int
expe
x
tedNumberOfRows
=
phaseLevel
.
get
Order
()
+
1
;
final
int
expe
c
tedNumberOfRows
=
currentPhase
Order
+
1
;
if
(
numberOfRows
==
expe
x
tedNumberOfRows
)
{
if
(
numberOfRows
==
expe
c
tedNumberOfRows
)
{
return
;
}
else
if
(
numberOfRows
<
expe
x
tedNumberOfRows
)
{
List
<
DecisionMatrixRow
>
newDecisionMatrixRows
=
getNewDecisionMatrixRows
(
numberOfRows
,
expe
x
tedNumberOfRows
,
phaseLevel
);
}
else
if
(
numberOfRows
<
expe
c
tedNumberOfRows
)
{
List
<
DecisionMatrixRow
>
newDecisionMatrixRows
=
getNewDecisionMatrixRows
(
numberOfRows
,
expe
c
tedNumberOfRows
,
phaseLevel
);
phaseLevel
.
getDecisionMatrix
().
addAll
(
newDecisionMatrixRows
);
}
else
{
List
<
DecisionMatrixRow
>
neededDecisionMatrixRows
=
getOnlyNeededDecisionMatrixRows
(
expe
x
tedNumberOfRows
,
phaseLevel
);
List
<
DecisionMatrixRow
>
neededDecisionMatrixRows
=
getOnlyNeededDecisionMatrixRows
(
expe
c
tedNumberOfRows
,
phaseLevel
);
phaseLevel
.
getDecisionMatrix
().
clear
();
phaseLevel
.
getDecisionMatrix
().
addAll
(
neededDecisionMatrixRows
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment