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
a9e67d98
"git@git.uibk.ac.at:c102348/olat-ci-cd-testing-project.git" did not exist on "7b0a913b408273c0a0605ce210ff7ad5f9f46af2"
Commit
a9e67d98
authored
5 years ago
by
uhensler
Browse files
Options
Downloads
Patches
Plain Diff
OO-4100: Calculation of variance / standard deviation in survey reports
parent
12eaf5b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/modules/forms/model/jpa/RubricStatisticImpl.java
+10
-21
10 additions, 21 deletions
...org/olat/modules/forms/model/jpa/RubricStatisticImpl.java
with
10 additions
and
21 deletions
src/main/java/org/olat/modules/forms/model/jpa/RubricStatisticImpl.java
+
10
−
21
View file @
a9e67d98
...
...
@@ -178,13 +178,17 @@ public class RubricStatisticImpl implements RubricStatistic {
Double
mean
=
getAverage
(
stepCounts
);
if
(
mean
==
null
)
return
null
;
List
<
Double
>
scaledValues
=
getScaledValues
(
stepCounts
);
if
(
scaledValues
.
size
()
<
2
)
return
null
;
double
temp
=
0
;
for
(
double
a:
scaledValues
)
temp
+=
(
a
-
mean
)*(
a
-
mean
);
return
temp
/(
scaledValues
.
size
()
-
1
);
int
size
=
0
;
for
(
int
step
=
1
;
step
<=
rubric
.
getSteps
();
step
++)
{
double
value
=
rubric
.
getScaleType
().
getStepValue
(
rubric
.
getSteps
(),
step
);
int
count
=
stepCounts
.
get
(
step
-
1
).
intValue
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
temp
+=
(
value
-
mean
)*(
value
-
mean
);
size
++;
}
}
return
size
>
2
?
temp
/(
size
-
1
):
null
;
}
private
Double
getStdDev
(
List
<
Long
>
stepCounts
)
{
...
...
@@ -194,21 +198,6 @@ public class RubricStatisticImpl implements RubricStatistic {
return
Math
.
sqrt
(
getVariance
(
stepCounts
));
}
private
List
<
Double
>
getScaledValues
(
List
<
Long
>
stepCounts
)
{
List
<
Double
>
scaledValues
=
new
ArrayList
<>();
for
(
int
step
=
1
;
step
<=
rubric
.
getSteps
();
step
++)
{
Long
count
=
stepCounts
.
get
(
step
-
1
);
if
(
count
!=
null
)
{
double
stepValue
=
rubric
.
getScaleType
().
getStepValue
(
rubric
.
getSteps
(),
step
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
double
scaledValue
=
stepValue
*
step
;
scaledValues
.
add
(
Double
.
valueOf
(
scaledValue
));
}
}
}
return
scaledValues
;
}
private
void
calculateTotalStatistics
()
{
Long
numberOfNoResponses
=
countedNoResponses
.
stream
().
mapToLong
(
CalculatedLong:
:
getValue
).
sum
();
List
<
Long
>
totalStepCounts
=
getTotalStepCounts
();
...
...
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