Commit b997fde5 authored by manishatyagi's avatar manishatyagi
Browse files

add partially correct question type in category assessment report

parent 685e773e
......@@ -168,8 +168,7 @@ public class AssessmentRepositoryImpl implements AssessmentRepositoryCustom {
// TODO Auto-generated method stub
log.debug("inside AssessmentRepositoryImpl called getAssessmentName method with parameter, startDate={},endDate={},subLobId={}",
startDate,endDate,subLobId);
/*
* AggregationOperation match = Aggregation.match(new Criteria().andOperator(Criteria.where("createdDate").gte(startDate),
AggregationOperation match = Aggregation.match(new Criteria().andOperator(Criteria.where("createdDate").gte(startDate),
Criteria.where("createdDate").lt(endDate),Criteria.where("subLob._id").is(subLobId),
new Criteria().orOperator(Criteria.where("status").is(CommonUtils.Assessment_Status.Assessment_Generated),
Criteria.where("status").is(CommonUtils.Assessment_Status.Assessment_Inprogress))));
......@@ -202,8 +201,8 @@ public class AssessmentRepositoryImpl implements AssessmentRepositoryCustom {
"createdDate","wrongUserId","misMatchUserId","completionDate","subLob","completedAssessment","totalAssessment","assessmentType")
.sum("passCount").as("passCount").sum("failCount").as("failCount").sum("pendingCount").as("pendingCount");
Aggregation agg = Aggregation.newAggregation(match,lookup,unwind,project,group,lookup1,unwind1,project1,group1);
*/
/*
AggregationOperation match = Aggregation.match(new Criteria().andOperator(Criteria.where("createdDate").gte(startDate),
Criteria.where("createdDate").lt(endDate),Criteria.where("subLob._id").is(subLobId),
new Criteria().orOperator(Criteria.where("status").is(CommonUtils.Assessment_Status.Assessment_Generated),
......@@ -231,7 +230,7 @@ public class AssessmentRepositoryImpl implements AssessmentRepositoryCustom {
AggregationOperation group = Aggregation.group("assessmentId","requestorName","requestorEcode","assessmentName","duration","location",
"createdDate","wrongUserId","misMatchUserId","completionDate","subLob","assessmentType").sum("completedAssessment").as("completedAssessment")
.sum("totalAssessment").as("totalAssessment").sum("passCount").as("passCount").sum("failCount").as("failCount").sum("pendingCount").as("pendingCount");
Aggregation agg = Aggregation.newAggregation(match,lookup,unwind,project,lookup1,unwind1,project1,group);
Aggregation agg = Aggregation.newAggregation(match,lookup,unwind,project,lookup1,unwind1,project1,group);*/
AggregationResults<DBObject> result = template.aggregate(agg,COLLECTION,DBObject.class);
log.debug("Response returned from AssessmentRepositoryImpl -- getAssessmentName method, result={}",result);
return result.getMappedResults();
......
......@@ -835,9 +835,12 @@ AggregationOperation match = Aggregation.match(new Criteria().andOperator(Crite
AggregationOperation unwind=Aggregation.unwind("questionList");
Cond correctQuestionOperation =ConditionalOperators.when(Criteria.where("questionList.questionResult").is(CommonUtils.Question_Result_Status.Correct.name())).then(1).otherwise(0);
Cond incorrectQuestionOperation =ConditionalOperators.when(Criteria.where("questionList.questionResult").is(CommonUtils.Question_Result_Status.Incorrect.name())).then(1).otherwise(0);
Cond partialCorrectQuesOpr =ConditionalOperators.when(Criteria.where("questionList.questionResult").is(CommonUtils.Question_Result_Status.Partially_Correct.name())).then(1).otherwise(0);
AggregationOperation project1 = Aggregation.project("userId").and("questionList.category").as("category")
.and(correctQuestionOperation).as("correctQues").and(incorrectQuestionOperation).as("inCorrectQues");
AggregationOperation group1=Aggregation.group("category").sum("correctQues").as("correctQues").sum("inCorrectQues").as("inCorrectQues");
.and(correctQuestionOperation).as("correctQues").and(incorrectQuestionOperation).as("inCorrectQues")
.and(partialCorrectQuesOpr).as("partialCorrectQues");
AggregationOperation group1=Aggregation.group("category").sum("correctQues").as("correctQues")
.sum("inCorrectQues").as("inCorrectQues").sum("partialCorrectQues").as("partialCorrectQues");
Aggregation agg = Aggregation.newAggregation(match,project,sort,group,unwind,project1,group1);
AggregationResults<DBObject> result = template.aggregate(agg,COLLECTION,DBObject.class);
log.debug("Response returned from QuizResultRepositoryImpl--getCategoryAssessmentInfographicReport method,result={}",result.getMappedResults().size());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment