Skip to content

Commit

Permalink
KB-5130 | DEV| Assessment | BE | Enhancement in Consumption Logic for…
Browse files Browse the repository at this point in the history
… the QuestionWeightage Assessment Type (#621)

1. Accuracy calculation is same for final assessment and practice assessment.
  • Loading branch information
tarentomaheshvakkund authored Jun 21, 2024
1 parent 9e4b1f1 commit 74e91be
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,12 @@ public SBApiResponse submitAssessmentAsync(Map<String, Object> submitRequest, St
}
}
if (Constants.SECTION_LEVEL_SCORE_CUTOFF.equalsIgnoreCase(scoreCutOffType)) {
boolean practiceAssessmentFlag = ((String) assessmentHierarchy.get(Constants.PRIMARY_CATEGORY)).equalsIgnoreCase(Constants.PRACTICE_QUESTION_SET);
long assessmentStartTime = 0;
if (existingAssessmentData.get(Constants.START_TIME)!=null) {
Date assessmentStart = (Date) existingAssessmentData.get(Constants.START_TIME);
assessmentStartTime = assessmentStart.getTime();
}
Map<String, Object> result = calculateSectionFinalResults(sectionLevelsResults,assessmentStartTime,assessmentCompletionTime,maxAssessmentRetakeAttempts,retakeAttemptsConsumed,practiceAssessmentFlag);
Map<String, Object> result = calculateSectionFinalResults(sectionLevelsResults,assessmentStartTime,assessmentCompletionTime,maxAssessmentRetakeAttempts,retakeAttemptsConsumed);
outgoingResponse.getResult().putAll(result);
outgoingResponse.getParams().setStatus(Constants.SUCCESS);
outgoingResponse.setResponseCode(HttpStatus.OK);
Expand Down Expand Up @@ -790,7 +789,7 @@ private void writeDataToDatabaseAndTriggerKafkaEvent(Map<String, Object> submitR
}
}

private Map<String, Object> calculateSectionFinalResults(List<Map<String, Object>> sectionLevelResults, long assessmentStartTime, long assessmentCompletionTime, int maxAssessmentRetakeAttempts, int retakeAttemptsConsumed, boolean practiceAssessmentFlag) {
private Map<String, Object> calculateSectionFinalResults(List<Map<String, Object>> sectionLevelResults, long assessmentStartTime, long assessmentCompletionTime, int maxAssessmentRetakeAttempts, int retakeAttemptsConsumed) {
Map<String, Object> res = new HashMap<>();
Double result;
Integer correct = 0;
Expand Down Expand Up @@ -820,11 +819,7 @@ private Map<String, Object> calculateSectionFinalResults(List<Map<String, Object
totalMarks += (Integer) sectionChildren.get(Constants.TOTAL_MARKS);
}
}
if(practiceAssessmentFlag){
res.put(Constants.OVERALL_RESULT, ((double)correct / (double)(blank+correct+inCorrect)) * 100);
}else{
res.put(Constants.OVERALL_RESULT, totalResult / sectionLevelResults.size());
}
res.put(Constants.OVERALL_RESULT, ((double)correct / (double)(blank+correct+inCorrect)) * 100);
res.put(Constants.BLANK, blank);
res.put(Constants.CORRECT, correct);
res.put(Constants.INCORRECT, inCorrect);
Expand Down

0 comments on commit 74e91be

Please sign in to comment.