Skip to content

Commit

Permalink
SAK-40516 import a grade map from another site even if the available …
Browse files Browse the repository at this point in the history
…grades dont match exactly (sakaiproject#7360)
  • Loading branch information
ottenhoff authored Sep 20, 2019
1 parent 5879b48 commit 190cc21
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,20 @@ public Map<String,String> transferGradebook(final GradebookInformation gradebook
// We have a match. Now make sure that the grades are as expected.
final Map<String, Double> inputGradePercents = gradebookInformation.getSelectedGradingScaleBottomPercents();
final Set<String> gradeCodes = inputGradePercents.keySet();
if (gradeCodes.containsAll(gradeMapping.getGradeMap().keySet())) {
// Modify the existing grade-to-percentage map.
for (final String gradeCode : gradeCodes) {
gradeMapping.getGradeMap().put(gradeCode, inputGradePercents.get(gradeCode));
}
gradebook.setSelectedGradeMapping(gradeMapping);
updateGradebook(gradebook);
log.info("Merge to gradebook {} updated grade mapping", toGradebookUid);
} else {
log.info("Merge to gradebook {} skipped grade mapping change because the {} grade codes did not match",
toGradebookUid, fromGradingScaleUid);

// If the grades dont map one-to-one, clear out the destination site's existing map
if (!gradeCodes.containsAll(gradeMapping.getGradeMap().keySet())) {
gradeMapping.getGradeMap().clear();
}

// Modify the existing grade-to-percentage map.
for (final String gradeCode : gradeCodes) {
gradeMapping.getGradeMap().put(gradeCode, inputGradePercents.get(gradeCode));
}
gradebook.setSelectedGradeMapping(gradeMapping);
updateGradebook(gradebook);
log.info("Merge to gradebook {} updated grade mapping", toGradebookUid);

break MERGE_GRADE_MAPPING;
}
}
Expand Down

0 comments on commit 190cc21

Please sign in to comment.