Skip to content

Commit

Permalink
KB-5745 | If user submits the test without selecting any answer optio…
Browse files Browse the repository at this point in the history
…ns, then the system is considering the assessment as unattempted (#640) (#643)

* KB-5745 | If user submits the test without selecting any answer options, then the system is considering the assessment as unattempted

1. If NaN value is there for double while convert the object to Json using mapper class its throwing error. Fixed by checking the value is greater than 0

* KB-5883 | The popup should be shown when user clicks on Retake button immediately after maximum attempt attended

1. If the retakeAttemptconsumed if less than 0  then consider it to be 0

Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
  • Loading branch information
SaipradeepR and tarentomaheshvakkund authored Jul 12, 2024
1 parent 8ee6bcd commit a04cb3d
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public SBApiResponse retakeAssessment(String assessmentIdentifier, String token,

// if (serverProperties.isAssessmentRetakeCountVerificationEnabled()) {
retakeAttemptsConsumed = calculateAssessmentRetakeCount(userId, assessmentIdentifier);
retakeAttemptsConsumed=retakeAttemptsConsumed-1;
if(retakeAttemptsConsumed>0){
retakeAttemptsConsumed=retakeAttemptsConsumed-1;
}
//}
} catch (Exception e) {
errMsg = String.format("Error while calculating retake assessment. Exception: %s", e.getMessage());
Expand Down Expand Up @@ -820,16 +822,24 @@ private Map<String, Object> calculateSectionFinalResults(List<Map<String, Object
totalMarks += (Integer) sectionChildren.get(Constants.TOTAL_MARKS);
}
}
res.put(Constants.OVERALL_RESULT, ((double)correct / (double)(correct+inCorrect)) * 100);
if(correct > 0 && inCorrect>0) {
res.put(Constants.OVERALL_RESULT, ((double) correct / (double) (correct + inCorrect)) * 100);
}else{
res.put(Constants.OVERALL_RESULT,0.0);
}
res.put(Constants.BLANK, blank);
res.put(Constants.CORRECT, correct);
res.put(Constants.INCORRECT, inCorrect);
res.put(Constants.PASS, (pass == sectionLevelResults.size()));
res.put(Constants.TIME_TAKEN_FOR_ASSESSMENT,assessmentCompletionTime-assessmentStartTime);
res.put(Constants.MAX_ASSESSMENT_RETAKE_ATTEMPTS,maxAssessmentRetakeAttempts);
res.put(Constants.RETAKE_ATTEMPT_CONSUMED,retakeAttemptsConsumed);
double totalPercentage = (totalSectionMarks / (double)totalMarks) * 100;
res.put(Constants.TOTAL_PERCENTAGE, totalPercentage);
if(totalSectionMarks>0.0 && totalMarks>0) {
double totalPercentage = (totalSectionMarks / (double) totalMarks) * 100;
res.put(Constants.TOTAL_PERCENTAGE, totalPercentage);
}else{
res.put(Constants.TOTAL_PERCENTAGE,0.0);
}
res.put(Constants.TOTAL_SECTION_MARKS, totalSectionMarks);
res.put(Constants.TOTAL_MARKS, totalMarks);
} catch (Exception e) {
Expand Down

0 comments on commit a04cb3d

Please sign in to comment.