Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
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
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
a54926bd
Commit
a54926bd
authored
5 years ago
by
uhensler
Browse files
Options
Downloads
Patches
Plain Diff
OO-4080: Respect good end of the rubric when calculation max and min score
parent
bc567102
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/org/olat/course/nodes/ms/manager/MSServiceImpl.java
+29
-20
29 additions, 20 deletions
.../java/org/olat/course/nodes/ms/manager/MSServiceImpl.java
with
29 additions
and
20 deletions
src/main/java/org/olat/course/nodes/ms/manager/MSServiceImpl.java
+
29
−
20
View file @
a54926bd
...
@@ -145,54 +145,63 @@ public class MSServiceImpl implements MSService {
...
@@ -145,54 +145,63 @@ public class MSServiceImpl implements MSService {
@Override
@Override
public
MinMax
calculateMinMaxSum
(
RepositoryEntry
formEntry
,
float
scalingFactor
)
{
public
MinMax
calculateMinMaxSum
(
RepositoryEntry
formEntry
,
float
scalingFactor
)
{
double
sumMin
=
0.0
;
float
sumMin
=
0.0
f
;
double
sumMax
=
0.0
;
float
sumMax
=
0.0
f
;
Form
form
=
evaluationFormManager
.
loadForm
(
formEntry
);
Form
form
=
evaluationFormManager
.
loadForm
(
formEntry
);
for
(
AbstractElement
element
:
form
.
getElements
())
{
for
(
AbstractElement
element
:
form
.
getElements
())
{
if
(
Rubric
.
TYPE
.
equals
(
element
.
getType
()))
{
if
(
Rubric
.
TYPE
.
equals
(
element
.
getType
()))
{
Rubric
rubric
=
(
Rubric
)
element
;
Rubric
rubric
=
(
Rubric
)
element
;
MinMax
minMaxStep
=
calculateMinMaxStep
(
rubric
);
int
numberOfSliders
=
rubric
.
getSliders
().
size
();
int
numberOfSliders
=
rubric
.
getSliders
().
size
();
int
steps
=
rubric
.
getSteps
();
sumMin
+=
numberOfSliders
*
minMaxStep
.
getMin
();
Integer
weight
=
rubric
.
getWeight
();
sumMax
+=
numberOfSliders
*
minMaxStep
.
getMax
();
double
min
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
1
,
weight
);
double
max
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
steps
,
weight
);
sumMin
+=
numberOfSliders
*
min
;
sumMax
+=
numberOfSliders
*
max
;
}
}
}
}
sumMin
=
scalingFactor
*
sumMin
;
sumMin
=
scalingFactor
*
sumMin
;
sumMax
=
scalingFactor
*
sumMax
;
sumMax
=
scalingFactor
*
sumMax
;
return
MinMax
.
of
(
Float
.
valueOf
((
float
)
sumMin
)
,
Float
.
valueOf
((
float
)
sumMax
)
)
;
return
MinMax
.
of
(
sumMin
,
sumMax
);
}
}
@Override
@Override
public
MinMax
calculateMinMaxAvg
(
RepositoryEntry
formEntry
,
float
scalingFactor
)
{
public
MinMax
calculateMinMaxAvg
(
RepositoryEntry
formEntry
,
float
scalingFactor
)
{
double
sumMin
=
0.0
;
float
sumMin
=
0.0
f
;
double
sumMax
=
0.0
;
float
sumMax
=
0.0
f
;
int
numberAvgs
=
0
;
int
numberAvgs
=
0
;
Form
form
=
evaluationFormManager
.
loadForm
(
formEntry
);
Form
form
=
evaluationFormManager
.
loadForm
(
formEntry
);
for
(
AbstractElement
element
:
form
.
getElements
())
{
for
(
AbstractElement
element
:
form
.
getElements
())
{
if
(
Rubric
.
TYPE
.
equals
(
element
.
getType
()))
{
if
(
Rubric
.
TYPE
.
equals
(
element
.
getType
()))
{
Rubric
rubric
=
(
Rubric
)
element
;
Rubric
rubric
=
(
Rubric
)
element
;
MinMax
minMaxStep
=
calculateMinMaxStep
(
rubric
);
int
numberOfSliders
=
rubric
.
getSliders
().
size
();
int
numberOfSliders
=
rubric
.
getSliders
().
size
();
int
steps
=
rubric
.
getSteps
();
sumMin
+=
numberOfSliders
*
minMaxStep
.
getMin
();
Integer
weight
=
rubric
.
getWeight
();
sumMax
+=
numberOfSliders
*
minMaxStep
.
getMax
();
double
min
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
1
,
weight
);
double
max
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
steps
,
weight
);
sumMin
+=
numberOfSliders
*
min
;
sumMax
+=
numberOfSliders
*
max
;
numberAvgs
+=
numberOfSliders
;
numberAvgs
+=
numberOfSliders
;
}
}
}
}
if
(
numberAvgs
>
0
)
{
if
(
numberAvgs
>
0
)
{
double
avgMin
=
sumMin
/
numberAvgs
;
float
avgMin
=
sumMin
/
numberAvgs
;
avgMin
=
scalingFactor
*
avgMin
;
avgMin
=
scalingFactor
*
avgMin
;
double
avgMax
=
sumMax
/
numberAvgs
;
float
avgMax
=
sumMax
/
numberAvgs
;
avgMax
=
scalingFactor
*
avgMax
;
avgMax
=
scalingFactor
*
avgMax
;
return
MinMax
.
of
(
Float
.
valueOf
((
float
)
avgMin
)
,
Float
.
valueOf
((
float
)
avgMax
)
)
;
return
MinMax
.
of
(
avgMin
,
avgMax
);
}
}
return
MinMax
.
of
(
0.0f
,
0.0f
);
return
MinMax
.
of
(
0.0f
,
0.0f
);
}
}
private
MinMax
calculateMinMaxStep
(
Rubric
rubric
)
{
int
steps
=
rubric
.
getSteps
();
Integer
weight
=
rubric
.
getWeight
();
double
min
;
double
max
;
if
(
rubric
.
isStartGoodRating
())
{
min
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
steps
,
weight
);
max
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
1
,
weight
);
}
else
{
min
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
1
,
weight
);
max
=
rubric
.
getScaleType
().
getStepValue
(
steps
,
steps
,
weight
);
}
return
MinMax
.
of
(
Float
.
valueOf
((
float
)
min
),
Float
.
valueOf
((
float
)
max
));
}
@Override
@Override
public
Float
calculateScoreBySum
(
EvaluationFormSession
session
)
{
public
Float
calculateScoreBySum
(
EvaluationFormSession
session
)
{
...
...
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