Skip to content

Commit

Permalink
SAK-46657 provide better error message when points dont match categor… (
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Jun 9, 2022
1 parent 458a4b0 commit c90ae51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ append_copy_title=- Copy #
# gradebook can not accept an assessment if its totalpoint = 0,
gradebook_exception_min_points=Warning: A Gradebook item cannot be created for an assessment worth 0 points. Either edit the assessment to add a point value to at least one question or uncheck the "Send assessment score to Gradebook" box in Settings.
gradebook_exception_title_invalid=Warning: Assessments configured to send scores to Gradebook cannot have titles beginning with reserved characters * ] [ or # and must be revised. Please edit the assessment title before publishing.
gradebook_exception_category_invalid=Warning: all items in a Gradebook Category using drop lowest or drop highest must have matching point values. Either edit the assessment to alter the point values or choose a different category.

# Title of links: starts with t_
t_addPart=Add Part
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.sakaiproject.email.cover.EmailService;
import org.sakaiproject.event.cover.EventTrackingService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.grading.api.InvalidCategoryException;
import org.sakaiproject.rubrics.api.RubricsConstants;
import org.sakaiproject.rubrics.api.RubricsService;
import org.sakaiproject.rubrics.api.model.ToolItemRubricAssociation;
Expand Down Expand Up @@ -324,6 +325,12 @@ private void publish(AssessmentFacade assessment,
"gradebook_exception_title_invalid");
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(err));
throw new AbortProcessingException(gbe);
} catch (InvalidCategoryException gbe) {
log.warn("Incorrect gradebook category settings detected when attempting publish assessment: {}", gbe.toString());
String err = (String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages",
"gradebook_exception_category_invalid");
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(err));
throw new AbortProcessingException(gbe);
} catch (Exception e) {
log.warn(e.getMessage(), e);
// Add a global message (not bound to any component) to the faces context indicating the failure
Expand Down

0 comments on commit c90ae51

Please sign in to comment.