Skip to content

Commit

Permalink
4.8.17 dev v4 (#19)
Browse files Browse the repository at this point in the history
* KB-6563 | DEV| Assessment | BE | Consumption Logic for the CQF Assessment.

1. Added new api controller and service class for cqf assessment.

* KB-6592 | preview for option weightage  is throwing 500 error

1. Handled the randomization based on the assessmenttype.

* 4.8.17 dev revert changes - For CQF Assessment

Changes reverted for CQF Assessment

---------

Co-authored-by: tarentomaheshvakkund <[email protected]>
Co-authored-by: SaipradeepR <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent 06f600d commit d9b1838
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ private void readSectionLevelParams(Map<String, Object> assessmentAllDetail,
List<String> sectionIdList = new ArrayList<>();
List<String> sectionParams = serverProperties.getAssessmentSectionParams();
List<Map<String, Object>> sections = (List<Map<String, Object>>) assessmentAllDetail.get(Constants.CHILDREN);
String assessmentType = (String) assessmentAllDetail.get(Constants.ASSESSMENT_TYPE);
for (Map<String, Object> section : sections) {
sectionIdList.add((String) section.get(Constants.IDENTIFIER));
Map<String, Object> newSection = new HashMap<>();
Expand All @@ -481,10 +482,20 @@ private void readSectionLevelParams(Map<String, Object> assessmentAllDetail,
}
}
List<Map<String, Object>> questions = (List<Map<String, Object>>) section.get(Constants.CHILDREN);
List<Map<String, Object>> selectedQuestionsList = processRandomizationForQuestions((Map<String, Map<String, Object>>) section.get(Constants.SECTION_LEVEL_DEFINITION),questions);
List<String> childNodeList = selectedQuestionsList.stream()
.map(question -> (String) question.get(Constants.IDENTIFIER))
.collect(toList());
List<String> childNodeList;
if (assessmentType.equalsIgnoreCase(Constants.QUESTION_WEIGHTAGE)) {
List<Map<String, Object>> selectedQuestionsList = processRandomizationForQuestions((Map<String, Map<String, Object>>) section.get(Constants.SECTION_LEVEL_DEFINITION), questions);
childNodeList = selectedQuestionsList.stream()
.map(question -> (String) question.get(Constants.IDENTIFIER))
.collect(toList());
} else {
int maxQuestions = (int) section.getOrDefault(Constants.MAX_QUESTIONS, questions.size());
List<Map<String, Object>> shuffledQuestionsList = shuffleQuestions(questions);
childNodeList = shuffledQuestionsList.stream()
.map(question -> (String) question.get(Constants.IDENTIFIER))
.limit(maxQuestions)
.collect(toList());
}
Collections.shuffle(childNodeList);
newSection.put(Constants.CHILD_NODES, childNodeList);
sectionResponse.add(newSection);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ public class Constants {
public static final String CSV_FILE = ".csv";
public static final String XLSX_FILE = ".xlsx";
public static final String NO_OF_QUESTIONS = "noOfQuestions";
public static final String CADRE_DETAILS = "cadreDetails";
public static final String CADRE_DETAILS = "cadreDetails";
public static final String CADRE_CONFIG = "cadreConfig";
public static final String CIVIL_SERVICE_TYPE = "civilServiceType";
public static final String SERVICE_TYPE = "serviceList";
Expand Down

0 comments on commit d9b1838

Please sign in to comment.