Include infos about meeting endedOn and fix problem where user leftOn was never set if meeting ends before they left
This commit is contained in:
parent
369cd25165
commit
42e32b7ba8
@ -17,9 +17,12 @@ case class MeetingActivityTracker(
|
||||
intId: String,
|
||||
extId: String,
|
||||
name: String,
|
||||
activityReportAccessToken: String,
|
||||
users: Map[String, UserActivityTracker] = Map(),
|
||||
polls: Map[String, Poll] = Map(),
|
||||
screenshares: Vector[Screenshare] = Vector(),
|
||||
createdOn: Long = System.currentTimeMillis(),
|
||||
endedOn: Long = 0,
|
||||
)
|
||||
|
||||
case class UserActivityTracker(
|
||||
@ -318,6 +321,7 @@ class ActivityTrackerActor(
|
||||
msg.body.props.meetingProp.intId,
|
||||
msg.body.props.meetingProp.extId,
|
||||
msg.body.props.meetingProp.name,
|
||||
msg.body.props.password.activityReportAccessToken,
|
||||
)
|
||||
|
||||
meetings += (newMeeting.intId -> newMeeting)
|
||||
@ -332,22 +336,38 @@ class ActivityTrackerActor(
|
||||
for {
|
||||
meeting <- meetings.values.find(m => m.intId == msg.body.meetingId)
|
||||
} yield {
|
||||
//Send report one last time
|
||||
sendPeriodicReport()
|
||||
|
||||
meetings = meetings.-(meeting.intId)
|
||||
log.info("ActivityTracker removed for meeting {}.",meeting.intId)
|
||||
//Update endedOn
|
||||
val endedOn : Long = System.currentTimeMillis()
|
||||
var updatedMeeting = meeting.copy(endedOn = endedOn)
|
||||
|
||||
//Set all users leftOn
|
||||
updatedMeeting.users.values.filter(u => u.leftOn == 0).map(user => {
|
||||
updatedMeeting = updatedMeeting.copy(users = updatedMeeting.users + (user.intId -> user.copy(leftOn = endedOn)))
|
||||
})
|
||||
|
||||
meetings += (updatedMeeting.intId -> updatedMeeting)
|
||||
|
||||
//Send report one last time
|
||||
sendReport(updatedMeeting)
|
||||
|
||||
meetings = meetings.-(updatedMeeting.intId)
|
||||
log.info("ActivityTracker removed for meeting {}.",updatedMeeting.intId)
|
||||
}
|
||||
}
|
||||
|
||||
private def sendPeriodicReport(): Unit = {
|
||||
meetings.map(meeting => {
|
||||
val activityJson: String = JsonUtil.toJson(meeting._2)
|
||||
val event = MsgBuilder.buildActivityReportEvtMsg(meeting._2.intId, activityJson)
|
||||
outGW.send(event)
|
||||
|
||||
log.info("Activity Report sent for meeting {}",meeting._2.intId)
|
||||
sendReport(meeting._2)
|
||||
})
|
||||
}
|
||||
|
||||
private def sendReport(meeting : MeetingActivityTracker): Unit = {
|
||||
val activityJson: String = JsonUtil.toJson(meeting)
|
||||
val event = MsgBuilder.buildActivityReportEvtMsg(meeting.intId, activityJson)
|
||||
outGW.send(event)
|
||||
|
||||
log.info("Activity Report sent for meeting {}",meeting.intId)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.bigbluebutton.api.HTML5LoadBalancingService;
|
||||
@ -953,12 +954,14 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
public void processActivityReport(ActivityReport message) {
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
//Get all data from Json instead of getMeeting(message.meetingId), to process messages received even after meeting ended
|
||||
JsonObject activityJsonObject = new Gson().fromJson(message.activityJson, JsonObject.class).getAsJsonObject();
|
||||
String activityReportAccessToken = activityJsonObject.get("activityReportAccessToken").getAsString();
|
||||
|
||||
Map<String, Object> logData = new HashMap<String, Object>();
|
||||
logData.put("meetingId", m.getInternalId());
|
||||
logData.put("externalMeetingId", m.getExternalId());
|
||||
logData.put("name", m.getName());
|
||||
logData.put("meetingId", activityJsonObject.get("intId").getAsString());
|
||||
logData.put("externalMeetingId", activityJsonObject.get("extId").getAsString());
|
||||
logData.put("name", activityJsonObject.get("name").getAsString());
|
||||
logData.put("logCode", "update_activity_json");
|
||||
logData.put("description", "Updating activities json.");
|
||||
|
||||
@ -966,8 +969,8 @@ public class MeetingService implements MessageListener {
|
||||
String logStr = gson.toJson(logData);
|
||||
|
||||
log.info(" --analytics-- data={}", logStr);
|
||||
activityService.writeActivityJsonFile(message.meetingId, m.getActivityReportAccessToken(), message.activityJson);
|
||||
}
|
||||
|
||||
activityService.writeActivityJsonFile(message.meetingId, activityReportAccessToken, message.activityJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user