Skip to content

Commit

Permalink
SAK-32445 Fix Assignments Grading with ".X" Grades (sakaiproject#4250)
Browse files Browse the repository at this point in the history
When an assignment was saved with a grade such as ".7" with less
than the number of allowed decimal places (2 is default), the grade was
saved as "0.07"). This changes causes it to be saved as "0.70" by
padding entered scores with trailing 0s as appropriate.
  • Loading branch information
master-bob authored and jonespm committed Apr 18, 2017
1 parent cfcb7e4 commit 4ffb895
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15097,8 +15097,16 @@ private String scalePointGrade(SessionState state, String point, int factor)
{
if (index == 0)
{
int trailingData = point.substring(1).length();
// if the point is the first char, add a 0 for the integer part
point = "0".concat(point.substring(1));
// ensure that the point value has the correct # of decimals
// by padding with zeros
if(trailingData < dec) {
for(int i = trailingData; i < dec; i++) {
point = point + "0";
}
}
}
else if (index < point.length() - 1)
{
Expand Down

0 comments on commit 4ffb895

Please sign in to comment.