From b274de9c3d63f87a5801874359d0ea46ef2e0c28 Mon Sep 17 00:00:00 2001 From: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:00:46 +0530 Subject: [PATCH] KB-5130 | DEV| Assessment | BE | Enhancement in Consumption Logic for the QuestionWeightage Assessment Type (#615) 1. Score Calculation fix for practice assessment. --- .../assessment/service/AssessmentServiceV5Impl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sunbird/assessment/service/AssessmentServiceV5Impl.java b/src/main/java/org/sunbird/assessment/service/AssessmentServiceV5Impl.java index 03dda2c10..a6bf50ffa 100644 --- a/src/main/java/org/sunbird/assessment/service/AssessmentServiceV5Impl.java +++ b/src/main/java/org/sunbird/assessment/service/AssessmentServiceV5Impl.java @@ -392,12 +392,13 @@ public SBApiResponse submitAssessmentAsync(Map 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 result = calculateSectionFinalResults(sectionLevelsResults,assessmentStartTime,assessmentCompletionTime,maxAssessmentRetakeAttempts,retakeAttemptsConsumed); + Map result = calculateSectionFinalResults(sectionLevelsResults,assessmentStartTime,assessmentCompletionTime,maxAssessmentRetakeAttempts,retakeAttemptsConsumed,practiceAssessmentFlag); outgoingResponse.getResult().putAll(result); outgoingResponse.getParams().setStatus(Constants.SUCCESS); outgoingResponse.setResponseCode(HttpStatus.OK); @@ -789,7 +790,7 @@ private void writeDataToDatabaseAndTriggerKafkaEvent(Map submitR } } - private Map calculateSectionFinalResults(List> sectionLevelResults,long assessmentStartTime,long assessmentCompletionTime,int maxAssessmentRetakeAttempts,int retakeAttemptsConsumed) { + private Map calculateSectionFinalResults(List> sectionLevelResults, long assessmentStartTime, long assessmentCompletionTime, int maxAssessmentRetakeAttempts, int retakeAttemptsConsumed, boolean practiceAssessmentFlag) { Map res = new HashMap<>(); Double result; Integer correct = 0; @@ -819,7 +820,11 @@ private Map calculateSectionFinalResults(List