Skip to content

Commit

Permalink
SAM-2668 Timer thread submission events can be logged incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
smarquard authored and ottenhoff committed Nov 18, 2015
1 parent 96b0835 commit ba13a48
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public void run(){
GradingService service = new GradingService();
AssessmentGradingData ag = service.load(timedAG.getAssessmentGradingId().toString(), false);
if (!ag.getForGrade().booleanValue()) {
// Change user id for the Gradebook update (if required) and so the event is associated with the correct userid
Session s = SessionManager.getCurrentSession();
if (s != null) {
s.setUserId(ag.getAgentId());
}

ag.setForGrade(Boolean.TRUE);
ag.setTimeElapsed(Integer.valueOf(timedAG.getTimeLimit()));
ag.setStatus(AssessmentGradingData.SUBMITTED); // this will change status 0 -> 1
Expand Down Expand Up @@ -111,12 +117,15 @@ public void run(){
eventLogData.setEclipseTime(null);
eventLogData.setErrorMsg(eventLogMessages.getString("error_take"));
}
eventLogFacade.setData(eventLogData);
eventLogFacade.setData(eventLogData);
eventService.saveOrUpdateEventLog(eventLogFacade);

PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService();
String siteId = publishedAssessmentService.getPublishedAssessmentOwner(ag.getPublishedAssessmentId());
EventTrackingService.post(EventTrackingService.newEvent("sam.assessment.thread_submit", "siteId=" + AgentFacade.getCurrentSiteId() + ", submissionId=" + ag.getAssessmentGradingId(), siteId, true, NotificationService.NOTI_REQUIRED));
EventTrackingService.post(EventTrackingService.newEvent("sam.assessment.thread_submit", "siteId=" + siteId + ", submissionId=" + ag.getAssessmentGradingId(), siteId, true, NotificationService.NOTI_REQUIRED));
notifyGradebookByScoringType(ag, timedAG.getPublishedAssessment());
log.debug("**** 4a. time's up, timeLeft+latency buffer reached, saved to DB");
log.info("Submitted timed assessment assessmentId=" + eventLogData.getAssessmentId() + " userEid=" + eventLogData.getUserEid() + " siteId=" + siteId + ", submissionId=" + ag.getAssessmentGradingId());
}
}
}
Expand Down Expand Up @@ -157,12 +166,7 @@ private void notifyGradebookByScoringType(AssessmentGradingData ag, PublishedAss
if (publishedAssessment.getEvaluationModel().getScoringType().equals(EvaluationModelIfc.HIGHEST_SCORE)) {
assessmentGrading = g.getHighestSubmittedAssessmentGrading(publishedAssessment.getPublishedAssessmentId().toString(), ag.getAgentId());
}
Session s = SessionManager.getCurrentSession();
if (s != null)
{
s.setUserId(assessmentGrading.getAgentId());
g.notifyGradebook(assessmentGrading, publishedAssessment);
}
g.notifyGradebook(assessmentGrading, publishedAssessment);
}
}
}

0 comments on commit ba13a48

Please sign in to comment.