Skip to content

Commit

Permalink
SAK-47113 Dashboard and Gradebook: Not released gradebook items are v…
Browse files Browse the repository at this point in the history
…isible to the students via dashboard (sakaiproject#10390)
  • Loading branch information
druiz309 authored Apr 1, 2022
1 parent b3b6ab9 commit bb3fd0e
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1988,17 +1988,19 @@ public Long addAssignment(final Assignment assignment) {

EventHelper.postAddAssignmentEvent(gradebook, assignmentId, assignment, getUserRoleOrNone());

// Create the task
String reference = GradebookService.REFERENCE_ROOT + Entity.SEPARATOR + "a" + Entity.SEPARATOR + getCurrentSiteId() + Entity.SEPARATOR + assignmentId;
Task task = new Task();
task.setSiteId(getCurrentSiteId());
task.setReference(reference);
task.setSystem(true);
task.setDescription(assignment.getName());
task.setDue((assignment.getDueDate() == null) ? null : assignment.getDueDate().toInstant());
Set<String> users = new HashSet<>(this.getGradeableUsers());
taskService.createTask(task, users, Priorities.HIGH);

// Create the task if it is released
if(assignment.isReleased()) {
String reference = GradebookService.REFERENCE_ROOT + Entity.SEPARATOR + "a" + Entity.SEPARATOR + getCurrentSiteId() + Entity.SEPARATOR + assignmentId;
Task task = new Task();
task.setSiteId(getCurrentSiteId());
task.setReference(reference);
task.setSystem(true);
task.setDescription(assignment.getName());
task.setDue((assignment.getDueDate() == null) ? null : assignment.getDueDate().toInstant());
Set<String> users = new HashSet<>(this.getGradeableUsers());
taskService.createTask(task, users, Priorities.HIGH);
}

return assignmentId;

// TODO wrap this so we can catch any runtime exceptions
Expand Down Expand Up @@ -2250,7 +2252,7 @@ public void updateAssignment(final Assignment assignment) {
task.setDescription(assignment.getName());
task.setDue((assignment.getDueDate() == null) ? null : assignment.getDueDate().toInstant());
taskService.saveTask(task);
} else {
} else if(assignment.isReleased()) {
// Create the task
Task task = new Task();
task.setSiteId(getCurrentSiteId());
Expand Down

0 comments on commit bb3fd0e

Please sign in to comment.