Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MilderJoghurt
rlf-server
Commits
a1567bcc
Commit
a1567bcc
authored
Jun 29, 2015
by
Fjen Undso
Browse files
VoteController: sum of votes for stats. faster negative all rating. fixes
#1
parent
194d9a90
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/VoteController.java
View file @
a1567bcc
...
...
@@ -121,10 +121,10 @@ public class VoteController extends Controller {
if
(
v
.
date
.
after
(
tenMinutesAgo
))
{
switch
(
v
.
type
)
{
case
SPEED:
sSpeed
.
value
=
v
.
value
;
sSpeed
.
value
+
=
v
.
value
;
break
;
case
UNDERSTANDABILITY:
sUnderstandability
.
value
=
v
.
value
;
sUnderstandability
.
value
+
=
v
.
value
;
break
;
case
REQUEST:
// consider only last 30sek
...
...
@@ -150,7 +150,12 @@ public class VoteController extends Controller {
// arithmetic mean of votes
sSpeed
.
value
=
sSpeed
.
value
/
sUsers
.
value
;
sUnderstandability
.
value
=
sUnderstandability
.
value
/
sUsers
.
value
;
sAll
.
value
=
(
100
-
(
Math
.
abs
(
sSpeed
.
value
-
50
)
*
2
)
+
sUnderstandability
.
value
)
/
2
;
if
(
20
<
sSpeed
.
value
||
sSpeed
.
value
>
80
||
sUnderstandability
.
value
<
20
)
{
// give negative overall rating, is one value is very bad
sAll
.
value
=
0
;
}
else
{
sAll
.
value
=
(
100
-
(
Math
.
abs
(
sSpeed
.
value
-
50
)
*
2
)
+
sUnderstandability
.
value
)
/
2
;
}
}
return
ok
(
Json
.
toJson
(
vsList
));
// 200
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment