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
02bacc6d
Commit
02bacc6d
authored
Jun 28, 2015
by
Fjen Undso
Browse files
fix vote request reset for sure
parent
662566e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/VoteController.java
View file @
02bacc6d
...
...
@@ -5,6 +5,8 @@ import java.util.Date;
import
java.util.HashSet
;
import
java.util.List
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
models.Session
;
import
models.Vote
;
import
models.VoteStats
;
...
...
@@ -13,8 +15,6 @@ import play.mvc.BodyParser;
import
play.mvc.Controller
;
import
play.mvc.Result
;
import
com.fasterxml.jackson.databind.JsonNode
;
/**
* Provides REST API calls for {@link Vote} creation
*/
...
...
@@ -47,9 +47,9 @@ public class VoteController extends Controller {
// session owner has the power to reset all
List
<
Vote
>
sessionvotes
=
new
ArrayList
<
Vote
>(
session
.
votes
);
for
(
Vote
v
:
sessionvotes
)
{
if
(
v
.
type
==
Vote
.
Type
.
REQUEST
&&
(
v
.
owner
==
vote
.
owner
||
vote
.
owner
==
session
.
owner
))
{
if
(
v
.
type
==
Vote
.
Type
.
REQUEST
&&
(
vote
.
owner
.
equals
(
v
.
owner
)
||
vote
.
owner
.
equals
(
session
.
owner
)))
{
session
.
deleteVote
(
v
);
v
.
delete
();
}
}
}
else
{
...
...
@@ -96,8 +96,7 @@ public class VoteController extends Controller {
}
else
{
VoteStats
sAll
=
new
VoteStats
(
VoteStats
.
Type
.
ALL
,
0
);
VoteStats
sSpeed
=
new
VoteStats
(
VoteStats
.
Type
.
SPEED
,
0
);
VoteStats
sUnderstandability
=
new
VoteStats
(
VoteStats
.
Type
.
UNDERSTANDABILITY
,
0
);
VoteStats
sUnderstandability
=
new
VoteStats
(
VoteStats
.
Type
.
UNDERSTANDABILITY
,
0
);
VoteStats
sRequests
=
new
VoteStats
(
VoteStats
.
Type
.
REQUEST
,
0
);
VoteStats
sUsers
=
new
VoteStats
(
VoteStats
.
Type
.
CURRENTUSERS
,
0
);
List
<
VoteStats
>
vsList
=
new
ArrayList
<
VoteStats
>();
...
...
@@ -115,9 +114,10 @@ public class VoteController extends Controller {
switch
(
v
.
type
)
{
case
SPEED:
// TODO: aggregate
//Date tenMinutesAgo = new Date();
//tenMinutesAgo = new Date(tenMinutesAgo.getTime() - (10 * 60000)); //60000 is 1 minute equivalent in milliseconds
//if (v.date.after(tenMinutesAgo))
// Date tenMinutesAgo = new Date();
// tenMinutesAgo = new Date(tenMinutesAgo.getTime() - (10 *
// 60000)); //60000 is 1 minute equivalent in milliseconds
// if (v.date.after(tenMinutesAgo))
sSpeed
.
value
=
v
.
value
;
break
;
case
UNDERSTANDABILITY:
...
...
app/models/Session.java
View file @
02bacc6d
...
...
@@ -90,6 +90,7 @@ public class Session extends Model {
public
void
deleteVote
(
Vote
v
)
{
this
.
votes
.
remove
(
v
);
v
.
delete
();
}
public
void
addVote
(
Vote
v
)
{
...
...
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