Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes for checking the time taken in assessment submit #251

Open
wants to merge 1 commit into
base: cbrelease-4.8.3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,23 @@ private Map<String, String> validateQuestionListAPI(Map<String, Object> requestB

@Override
public SBApiResponse submitAssessment(Map<String, Object> submitRequest, String authUserToken) throws IOException {
logger.info("Assessment Service Impl:: submitAssessment: Started");
long duration = 0;
long startTime = System.currentTimeMillis();
long initialStartTime = startTime;
long finalDuration = 0;
logger.info("Assessment Service Impl:: submitAssessment: Started");
SBApiResponse outgoingResponse = createDefaultResponse(Constants.API_SUBMIT_ASSESSMENT);
String errMsg;
List<Map<String, Object>> sectionListFromSubmitRequest = new ArrayList<>();
List<Map<String, Object>> hierarchySectionList = new ArrayList<>();
List<String> questionsListFromAssessmentHierarchy = new ArrayList<>();
Map<String, Object> assessmentHierarchy = new HashMap<>();
errMsg = validateSubmitAssessmentRequest(submitRequest, authUserToken, hierarchySectionList, sectionListFromSubmitRequest, assessmentHierarchy);
duration = System.currentTimeMillis() - startTime;
logger.info("UserBulkUploadService:: validateSubmitAssessmentRequest: Completed. Time taken: "
+ duration + " milli-seconds");
startTime = System.currentTimeMillis();
if (errMsg.isEmpty()) {
String userId = validateAuthTokenAndFetchUserId(authUserToken);
String scoreCutOffType = ((String) assessmentHierarchy.get(Constants.SCORE_CUTOFF_TYPE)).toLowerCase();
Expand Down Expand Up @@ -361,6 +371,12 @@ public SBApiResponse submitAssessment(Map<String, Object> submitRequest, String
result.putAll(createResponseMapWithProperStructure(hierarchySection, assessUtilServ.validateQumlAssessment(questionsListFromAssessmentHierarchy, questionsListFromSubmitRequest)));
outgoingResponse.getResult().putAll(calculateAssessmentFinalResults(result));
writeDataToDatabaseAndTriggerKafkaEvent(submitRequest, userId, questionSetFromAssessment, result, (String) assessmentHierarchy.get(Constants.PRIMARY_CATEGORY));
duration = System.currentTimeMillis() - startTime;
logger.info("UserBulkUploadService:: Primary Category !PracticeQuestionSet - Assessment Level Score Cutoff: Completed. Time taken: "
+ duration + " milli-seconds");
finalDuration = System.currentTimeMillis() - initialStartTime;
logger.info("UserBulkUploadService::Total Time: Completed. Time taken: "
+ finalDuration + " milli-seconds");
return outgoingResponse;
}
case Constants.SECTION_LEVEL_SCORE_CUTOFF: {
Expand All @@ -371,7 +387,6 @@ public SBApiResponse submitAssessment(Map<String, Object> submitRequest, String
default:
break;
}

} else {
hierarchySection.put(Constants.SCORE_CUTOFF_TYPE, scoreCutOffType);
List<Map<String, Object>> questionsListFromSubmitRequest = new ArrayList<>();
Expand All @@ -386,6 +401,12 @@ public SBApiResponse submitAssessment(Map<String, Object> submitRequest, String
case Constants.ASSESSMENT_LEVEL_SCORE_CUTOFF: {
result.putAll(createResponseMapWithProperStructure(hierarchySection, assessUtilServ.validateQumlAssessment(questionsListFromAssessmentHierarchy, questionsListFromSubmitRequest)));
outgoingResponse.getResult().putAll(calculateAssessmentFinalResults(result));
duration = System.currentTimeMillis() - startTime;
logger.info("UserBulkUploadService:: Primary Category.. Practice Assessment - Assessment Level Score Cutoff: Completed. Time taken: "
+ duration + " milli-seconds");
finalDuration = System.currentTimeMillis() - initialStartTime;
logger.info("UserBulkUploadService::Total Time: Completed. Time taken: "
+ finalDuration + " milli-seconds");
return outgoingResponse;
}
case Constants.SECTION_LEVEL_SCORE_CUTOFF: {
Expand All @@ -402,6 +423,12 @@ public SBApiResponse submitAssessment(Map<String, Object> submitRequest, String
Map<String, Object> result = calculateSectionFinalResults(sectionLevelsResults);
outgoingResponse.getResult().putAll(result);
writeDataToDatabaseAndTriggerKafkaEvent(submitRequest, userId, questionSetFromAssessment, result, (String) assessmentHierarchy.get(Constants.PRIMARY_CATEGORY));
duration = System.currentTimeMillis() - startTime;
logger.info("UserBulkUploadService::Sectional Level Score Cutoff: Completed. Time taken: "
+ duration + " milli-seconds");
finalDuration = System.currentTimeMillis() - initialStartTime;
logger.info("UserBulkUploadService::Total Time: Completed. Time taken: "
+ finalDuration + " milli-seconds");
return outgoingResponse;
}
}
Expand Down