Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
John Samuel Ako Deutesfeld
ARSnova Backend
Commits
a6ea68c8
Commit
a6ea68c8
authored
6 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
Use entity IDs as parameters for Websocket report methods
parent
9ccec8eb
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/thm/arsnova/websocket/ArsnovaSocketioServerImpl.java
+24
-24
24 additions, 24 deletions
...a/de/thm/arsnova/websocket/ArsnovaSocketioServerImpl.java
with
24 additions
and
24 deletions
src/main/java/de/thm/arsnova/websocket/ArsnovaSocketioServerImpl.java
+
24
−
24
View file @
a6ea68c8
...
@@ -403,14 +403,14 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -403,14 +403,14 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
}
}
}
}
public
void
reportUpdatedFeedbackForRoom
(
final
de
.
thm
.
arsnova
.
model
.
Room
room
)
{
public
void
reportUpdatedFeedbackForRoom
(
final
String
room
Id
)
{
final
de
.
thm
.
arsnova
.
model
.
Feedback
fb
=
feedbackService
.
getByRoomId
(
room
.
getId
()
);
final
de
.
thm
.
arsnova
.
model
.
Feedback
fb
=
feedbackService
.
getByRoomId
(
room
Id
);
broadcastInRoom
(
room
.
getId
()
,
"feedbackData"
,
fb
.
getValues
());
broadcastInRoom
(
room
Id
,
"feedbackData"
,
fb
.
getValues
());
try
{
try
{
final
long
averageFeedback
=
feedbackService
.
calculateRoundedAverageFeedback
(
room
.
getId
()
);
final
long
averageFeedback
=
feedbackService
.
calculateRoundedAverageFeedback
(
room
Id
);
broadcastInRoom
(
room
.
getId
()
,
"feedbackDataRoundedAverage"
,
averageFeedback
);
broadcastInRoom
(
room
Id
,
"feedbackDataRoundedAverage"
,
averageFeedback
);
}
catch
(
final
NoContentException
e
)
{
}
catch
(
final
NoContentException
e
)
{
broadcastInRoom
(
room
.
getId
()
,
"feedbackDataRoundedAverage"
,
null
);
broadcastInRoom
(
room
Id
,
"feedbackDataRoundedAverage"
,
null
);
}
}
}
}
...
@@ -441,16 +441,16 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -441,16 +441,16 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
broadcastInRoom
(
roomId
,
"activeUserCountData"
,
count
);
broadcastInRoom
(
roomId
,
"activeUserCountData"
,
count
);
}
}
public
void
reportAnswersToContentAvailable
(
final
de
.
thm
.
arsnova
.
model
.
Room
room
,
final
Content
content
)
{
public
void
reportAnswersToContentAvailable
(
final
String
room
Id
,
final
String
content
Id
)
{
broadcastInRoom
(
room
.
getId
()
,
"answersToLecQuestionAvail"
,
content
.
get_id
()
);
broadcastInRoom
(
room
Id
,
"answersToLecQuestionAvail"
,
content
Id
);
}
}
public
void
reportCommentAvailable
(
final
de
.
thm
.
arsnova
.
model
.
Room
room
,
final
Comment
comment
)
{
public
void
reportCommentAvailable
(
final
String
room
Id
,
final
String
comment
Id
)
{
/* TODO role handling implementation, send this only to users with role lecturer */
/* TODO role handling implementation, send this only to users with role lecturer */
broadcastInRoom
(
room
.
getId
()
,
"audQuestionAvail"
,
comment
.
getId
()
);
broadcastInRoom
(
room
Id
,
"audQuestionAvail"
,
comment
Id
);
}
}
public
void
reportContentAvailable
(
final
de
.
thm
.
arsnova
.
model
.
Room
room
,
final
List
<
de
.
thm
.
arsnova
.
model
.
Content
>
qs
)
{
public
void
reportContentAvailable
(
final
String
room
Id
,
final
List
<
de
.
thm
.
arsnova
.
model
.
Content
>
qs
)
{
List
<
Content
>
contents
=
new
ArrayList
<>();
List
<
Content
>
contents
=
new
ArrayList
<>();
for
(
de
.
thm
.
arsnova
.
model
.
Content
q
:
qs
)
{
for
(
de
.
thm
.
arsnova
.
model
.
Content
q
:
qs
)
{
contents
.
add
(
new
Content
(
q
));
contents
.
add
(
new
Content
(
q
));
...
@@ -458,17 +458,17 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -458,17 +458,17 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
/* TODO role handling implementation, send this only to users with role audience */
/* TODO role handling implementation, send this only to users with role audience */
if
(!
qs
.
isEmpty
())
{
if
(!
qs
.
isEmpty
())
{
broadcastInRoom
(
room
.
getId
()
,
"lecQuestionAvail"
,
contents
.
get
(
0
).
get_id
());
// deprecated!
broadcastInRoom
(
room
Id
,
"lecQuestionAvail"
,
contents
.
get
(
0
).
get_id
());
// deprecated!
}
}
broadcastInRoom
(
room
.
getId
()
,
"lecturerQuestionAvailable"
,
contents
);
broadcastInRoom
(
room
Id
,
"lecturerQuestionAvailable"
,
contents
);
}
}
public
void
reportContentsLocked
(
final
de
.
thm
.
arsnova
.
model
.
Room
room
,
final
List
<
de
.
thm
.
arsnova
.
model
.
Content
>
qs
)
{
public
void
reportContentsLocked
(
final
String
room
Id
,
final
List
<
de
.
thm
.
arsnova
.
model
.
Content
>
qs
)
{
List
<
Content
>
contents
=
new
ArrayList
<>();
List
<
Content
>
contents
=
new
ArrayList
<>();
for
(
de
.
thm
.
arsnova
.
model
.
Content
q
:
qs
)
{
for
(
de
.
thm
.
arsnova
.
model
.
Content
q
:
qs
)
{
contents
.
add
(
new
Content
(
q
));
contents
.
add
(
new
Content
(
q
));
}
}
broadcastInRoom
(
room
.
getId
()
,
"lecturerQuestionLocked"
,
contents
);
broadcastInRoom
(
room
Id
,
"lecturerQuestionLocked"
,
contents
);
}
}
public
void
reportRoomStatus
(
final
String
roomId
,
final
boolean
active
)
{
public
void
reportRoomStatus
(
final
String
roomId
,
final
boolean
active
)
{
...
@@ -492,32 +492,32 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -492,32 +492,32 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
@EventListener
@EventListener
public
void
handleNewQuestion
(
NewQuestionEvent
event
)
{
public
void
handleNewQuestion
(
NewQuestionEvent
event
)
{
this
.
reportContentAvailable
(
event
.
getRoom
(),
Collections
.
singletonList
(
event
.
getQuestion
()));
this
.
reportContentAvailable
(
event
.
getRoom
()
.
getId
()
,
Collections
.
singletonList
(
event
.
getQuestion
()));
}
}
@EventListener
@EventListener
public
void
handleUnlockQuestion
(
UnlockQuestionEvent
event
)
{
public
void
handleUnlockQuestion
(
UnlockQuestionEvent
event
)
{
this
.
reportContentAvailable
(
event
.
getRoom
(),
Collections
.
singletonList
(
event
.
getQuestion
()));
this
.
reportContentAvailable
(
event
.
getRoom
()
.
getId
()
,
Collections
.
singletonList
(
event
.
getQuestion
()));
}
}
@EventListener
@EventListener
public
void
handleLockQuestion
(
LockQuestionEvent
event
)
{
public
void
handleLockQuestion
(
LockQuestionEvent
event
)
{
this
.
reportContentsLocked
(
event
.
getRoom
(),
Collections
.
singletonList
(
event
.
getQuestion
()));
this
.
reportContentsLocked
(
event
.
getRoom
()
.
getId
()
,
Collections
.
singletonList
(
event
.
getQuestion
()));
}
}
@EventListener
@EventListener
public
void
handleUnlockQuestions
(
UnlockQuestionsEvent
event
)
{
public
void
handleUnlockQuestions
(
UnlockQuestionsEvent
event
)
{
this
.
reportContentAvailable
(
event
.
getRoom
(),
event
.
getQuestions
());
this
.
reportContentAvailable
(
event
.
getRoom
()
.
getId
()
,
event
.
getQuestions
());
}
}
@EventListener
@EventListener
public
void
handleLockQuestions
(
LockQuestionsEvent
event
)
{
public
void
handleLockQuestions
(
LockQuestionsEvent
event
)
{
this
.
reportContentsLocked
(
event
.
getRoom
(),
event
.
getQuestions
());
this
.
reportContentsLocked
(
event
.
getRoom
()
.
getId
()
,
event
.
getQuestions
());
}
}
@EventListener
@EventListener
public
void
handleNewComment
(
NewCommentEvent
event
)
{
public
void
handleNewComment
(
NewCommentEvent
event
)
{
this
.
reportCommentAvailable
(
event
.
getRoom
(),
event
.
getQuestion
());
this
.
reportCommentAvailable
(
event
.
getRoom
()
.
getId
()
,
event
.
getQuestion
()
.
getId
()
);
}
}
@Async
@Async
...
@@ -525,7 +525,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -525,7 +525,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
@Timed
@Timed
public
void
handleNewAnswer
(
NewAnswerEvent
event
)
{
public
void
handleNewAnswer
(
NewAnswerEvent
event
)
{
final
String
roomId
=
event
.
getRoom
().
getId
();
final
String
roomId
=
event
.
getRoom
().
getId
();
this
.
reportAnswersToContentAvailable
(
event
.
getRoom
()
,
new
Content
(
event
.
getContent
()));
this
.
reportAnswersToContentAvailable
(
event
.
getRoom
()
.
getId
(),
event
.
getContent
()
.
getId
(
));
broadcastInRoom
(
roomId
,
"countQuestionAnswersByQuestionId"
,
answerService
.
countAnswersAndAbstentionsInternal
(
event
.
getContent
().
getId
()));
broadcastInRoom
(
roomId
,
"countQuestionAnswersByQuestionId"
,
answerService
.
countAnswersAndAbstentionsInternal
(
event
.
getContent
().
getId
()));
/* FIXME: Content variant is ignored for now */
/* FIXME: Content variant is ignored for now */
broadcastInRoom
(
roomId
,
"countLectureQuestionAnswers"
,
answerService
.
countTotalAnswersByRoomId
(
roomId
));
broadcastInRoom
(
roomId
,
"countLectureQuestionAnswers"
,
answerService
.
countTotalAnswersByRoomId
(
roomId
));
...
@@ -545,7 +545,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -545,7 +545,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
@Timed
@Timed
public
void
handleDeleteAnswer
(
DeleteAnswerEvent
event
)
{
public
void
handleDeleteAnswer
(
DeleteAnswerEvent
event
)
{
final
String
roomId
=
event
.
getRoom
().
getId
();
final
String
roomId
=
event
.
getRoom
().
getId
();
this
.
reportAnswersToContentAvailable
(
event
.
getRoom
()
,
new
Content
(
event
.
getQuestion
()));
this
.
reportAnswersToContentAvailable
(
event
.
getRoom
()
.
getId
(),
event
.
getQuestion
()
.
getId
(
));
// We do not know which user's answer was deleted, so we can't update his 'unanswered' list of questions...
// We do not know which user's answer was deleted, so we can't update his 'unanswered' list of questions...
/* FIXME: Content variant is ignored for now */
/* FIXME: Content variant is ignored for now */
broadcastInRoom
(
roomId
,
"countLectureQuestionAnswers"
,
answerService
.
countTotalAnswersByRoomId
(
roomId
));
broadcastInRoom
(
roomId
,
"countLectureQuestionAnswers"
,
answerService
.
countTotalAnswersByRoomId
(
roomId
));
...
@@ -636,7 +636,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
...
@@ -636,7 +636,7 @@ public class ArsnovaSocketioServerImpl implements ArsnovaSocketioServer {
@EventListener
@EventListener
public
void
handleNewFeedback
(
NewFeedbackEvent
event
)
{
public
void
handleNewFeedback
(
NewFeedbackEvent
event
)
{
this
.
reportUpdatedFeedbackForRoom
(
event
.
getRoom
());
this
.
reportUpdatedFeedbackForRoom
(
event
.
getRoom
()
.
getId
()
);
}
}
@EventListener
@EventListener
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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