Skip to content

Commit

Permalink
SAK-33492 Assignment move asn.new.asignment event to after its fully …
Browse files Browse the repository at this point in the history
…initialized (sakaiproject#5108)
  • Loading branch information
ern authored Dec 11, 2017
1 parent 2076a3b commit 7be4ec7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ public Assignment addAssignment(String context) throws PermissionException {

log.debug("Created new assignment {}", assignment.getId());

String reference = AssignmentReferenceReckoner.reckoner().assignment(assignment).reckon().getReference();
// event for tracking
eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_ADD_ASSIGNMENT, reference, true));
// String reference = AssignmentReferenceReckoner.reckoner().assignment(assignment).reckon().getReference();
// AssignmentAction#post_save_assignment contains the logic for adding a new assignment
// the event should come at the end of that logic, eventually that logic should be moved here
// eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_ADD_ASSIGNMENT, reference, true));

return assignment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7465,11 +7465,13 @@ private void post_save_assignment(RunData data, String postOrSave) {
}

Assignment a;
boolean newAssignment = false;
// if there is no assignmentId
if (StringUtils.isBlank(assignmentId)) {
// create a new assignment
try {
a = assignmentService.addAssignment(siteId);
newAssignment = true;
} catch (PermissionException e) {
log.warn("Could not create new assignment for site: {}, {}", siteId, e.getMessage());
addAlert(state, rb.getFormattedMessage("youarenot_editAssignment", siteId));
Expand Down Expand Up @@ -7846,6 +7848,10 @@ private void post_save_assignment(RunData data, String postOrSave) {
}
}
}
if (newAssignment) {
// post new assignment event since it is fully initialized by now
eventTrackingService.post(eventTrackingService.newEvent(AssignmentConstants.EVENT_ADD_ASSIGNMENT, assignmentReference, true));
}
}
}

Expand Down

0 comments on commit 7be4ec7

Please sign in to comment.