Skip to content

Commit

Permalink
SAK-29616 - return the newly created assignment id in the addAssignme…
Browse files Browse the repository at this point in the history
…nt method
  • Loading branch information
maurercw committed Jul 1, 2015
1 parent 4e79a73 commit ea95557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ public boolean isAssignmentDefined(String gradebookUid, String assignmentTitle)
* Create a new Gradebook-managed assignment.
*
* @param assignmentDefinition
* @return the id of the newly created assignment
*/
public void addAssignment(String gradebookUid, Assignment assignmentDefinition);
public Long addAssignment(String gradebookUid, Assignment assignmentDefinition);

/**
* Modify the definition of an existing Gradebook-managed assignment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public Object doInHibernate(Session session) throws HibernateException {
}

@Override
public void addAssignment(String gradebookUid, org.sakaiproject.service.gradebook.shared.Assignment assignmentDefinition) {
public Long addAssignment(String gradebookUid, org.sakaiproject.service.gradebook.shared.Assignment assignmentDefinition) {
if (!getAuthz().isUserAbleToEditAssessments(gradebookUid)) {
log.error("AUTHORIZATION FAILURE: User " + getUserUid() + " in gradebook " + gradebookUid + " attempted to add an assignment");
throw new SecurityException("You do not have permission to perform this operation");
Expand All @@ -609,7 +609,7 @@ public void addAssignment(String gradebookUid, org.sakaiproject.service.gradeboo
}

Gradebook gradebook = getGradebook(gradebookUid);
createAssignment(gradebook.getId(), assignmentDefinition.getName(), points, assignmentDefinition.getDueDate(), !assignmentDefinition.isCounted(), assignmentDefinition.isReleased(), assignmentDefinition.isExtraCredit());
return createAssignment(gradebook.getId(), assignmentDefinition.getName(), points, assignmentDefinition.getDueDate(), !assignmentDefinition.isCounted(), assignmentDefinition.isReleased(), assignmentDefinition.isExtraCredit());
}

@SuppressWarnings({ "unchecked", "rawtypes" })
Expand Down

0 comments on commit ea95557

Please sign in to comment.