|
127 | 127 | import org.sakaiproject.exception.InUseException;
|
128 | 128 | import org.sakaiproject.exception.PermissionException;
|
129 | 129 | import org.sakaiproject.portal.util.PortalUtils;
|
| 130 | +import org.sakaiproject.grading.api.AssessmentNotFoundException; |
130 | 131 | import org.sakaiproject.grading.api.Assignment;
|
131 | 132 | import org.sakaiproject.grading.api.GradeDefinition;
|
132 | 133 | import org.sakaiproject.grading.api.GradeType;
|
@@ -4470,13 +4471,36 @@ private String processDfMsgGrdHelper(String userId, String msgAssignmentName) {
|
4470 | 4471 | selectedForum.setGradeAssign(forumDefaultAssignment);
|
4471 | 4472 | }
|
4472 | 4473 |
|
4473 |
| - if (selAssignmentName != null) { |
4474 |
| - setUpGradeInformation(gradebookUid, selAssignmentName, userId); |
4475 |
| - } else { |
4476 |
| - // this is the "Select a gradebook item" selection |
4477 |
| - allowedToGradeItem = false; |
4478 |
| - selGBItemRestricted = true; |
4479 |
| - } |
| 4474 | + |
| 4475 | + |
| 4476 | + try { |
| 4477 | + if (selAssignmentName != null) { |
| 4478 | + setUpGradeInformation(gradebookUid, selAssignmentName, userId); |
| 4479 | + } else { |
| 4480 | + // this is the "Select a gradebook item" selection |
| 4481 | + allowedToGradeItem = false; |
| 4482 | + selGBItemRestricted = true; |
| 4483 | + } |
| 4484 | + }catch (AssessmentNotFoundException e) { |
| 4485 | + if (msgAssignmentName !=null && msgAssignmentName.trim().length()>0) { |
| 4486 | + Message msg = selectedMessage.getMessage(); |
| 4487 | + msg.setGradeAssignmentName(null); |
| 4488 | + msg = forumManager.saveMessage(msg); |
| 4489 | + selectedMessage.setMessage(msg); |
| 4490 | + } else if (topicDefaultAssignment != null && topicDefaultAssignment.trim().length() > 0) { |
| 4491 | + DiscussionTopic dt = selectedTopic.getTopic(); |
| 4492 | + dt.setDefaultAssignName(null); |
| 4493 | + dt = forumManager.saveTopic(dt); |
| 4494 | + selectedTopic.setTopic(dt); |
| 4495 | + } else if (forumDefaultAssignment != null && forumDefaultAssignment.trim().length() > 0) { |
| 4496 | + DiscussionForum df = selectedForum.getForum(); |
| 4497 | + df.setDefaultAssignName(null); |
| 4498 | + df = forumManager.saveForum(df); |
| 4499 | + selectedForum.setForum(df); |
| 4500 | + } |
| 4501 | + allowedToGradeItem = false; |
| 4502 | + selGBItemRestricted = true; |
| 4503 | + } |
4480 | 4504 |
|
4481 | 4505 | return GRADE_MESSAGE;
|
4482 | 4506 | }
|
|
0 commit comments