Skip to content

Commit

Permalink
Merge pull request #109 from sunbird-cb/assessmentFinal
Browse files Browse the repository at this point in the history
assessment feature related changes
  • Loading branch information
karthik-tarento authored Jul 12, 2022
2 parents 1ba7812 + 4246862 commit f839b84
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;

@Service
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -219,11 +220,33 @@ private void readAssessmentLevelData(Map<String, Object> assessmentAllDetail, SB

private void readSectionLevelParams(Map<String, Object> assessmentAllDetail,
Map<String, Object> assessmentFilteredDetail) {
List<Map<String, Object>> sectionResponse = new ArrayList<>();
List<String> sectionParams = cbExtServerProperties.getAssessmentSectionParams();
List<Map<String, Object>> sections = (List<Map<String, Object>>) assessmentAllDetail.get(Constants.CHILDREN);
List<String> sectionIdList = new ArrayList<String>();
for (Map<String, Object> section : sections) {
sectionIdList.add((String) section.get(Constants.IDENTIFIER));
Map<String, Object> newSection = new HashMap<>();
for (String sectionParam : sectionParams) {
if (section.containsKey(sectionParam)) {
newSection.put(sectionParam, section.get(sectionParam));
}
}
List<String> allQuestionIdList = new ArrayList<String>();
List<Map<String, Object>> questions = (List<Map<String, Object>>) section.get(Constants.CHILDREN);
for (Map<String, Object> question : questions) {
allQuestionIdList.add((String) question.get(Constants.IDENTIFIER));
}
Collections.shuffle(allQuestionIdList);
List<String> childNodeList = new ArrayList<>();
if (!ObjectUtils.isEmpty(section.get(Constants.MAX_QUESTIONS))) {
int maxQuestions = (int) section.get(Constants.MAX_QUESTIONS);
childNodeList = allQuestionIdList.stream().limit(maxQuestions).collect(Collectors.toList());
}
newSection.put(Constants.CHILD_NODES, childNodeList);
sectionResponse.add(newSection);
}
assessmentFilteredDetail.put(Constants.CHILDREN, sectionResponse);
assessmentFilteredDetail.put(Constants.CHILD_NODES, sectionIdList);
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ redis.port=6379
redis.timeout=84600

#Assessment Feature values
assessment.host=https://igot-dev.in/api
assessment.hierarchy.read.path=/questionset/v1/hierarchy/{identifier}?mode=edit
assessment.question.list.path=/question/v1/list
assessment.host=http://assessment-service:9000/
assessment.hierarchy.read.path=questionset/v4/hierarchy/{identifier}?mode=edit
assessment.question.list.path=question/v4/list

#assessment.host=https://igot-dev.in/api/
#assessment.hierarchy.read.path=questionset/v1/hierarchy/{identifier}?hierarchy=detail
#assessment.question.list.path=question/v/list
assessment.read.assessmentLevel.params=name,identifier,primaryCategory,versionKey,mimeType,code,version,objectType,status,duration
assessment.read.sectionLevel.params=parent,name,identifier,description,trackable,primaryCategory,versionKey,mimeType,code,version,objectType,status,index,maxQuestions,scoreCutoffType
assessment.read.assessmentLevel.params=name,identifier,primaryCategory,versionKey,mimeType,code,version,objectType,status,expectedDuration,totalQuestions,maxQuestions,description
assessment.read.sectionLevel.params=parent,name,identifier,description,trackable,primaryCategory,versionKey,mimeType,code,version,objectType,status,index,maxQuestions,scoreCutoffType,minimumPassPercentage,additionalInstructions
assessment.read.questionLevel.params=parent,name,identifier,primaryCategory,body,versionKey,mimeType,code,objectType,status,qType,index,showSolutions,allowAnonymousAccess,visibility,version,showFeedback,license
assessment.read.min.question.params=parent,name,identifier,primaryCategory,versionKey,mimeType,objectType,qType

Expand Down

0 comments on commit f839b84

Please sign in to comment.