Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Sign in
Toggle navigation
Open sidebar
Kamal Agrawal
StateStreetProject-dev
Commits
685e773e
Commit
685e773e
authored
Jun 15, 2021
by
manishatyagi
Browse files
comment new code to get assessment name
parent
5e8e6e51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
src/main/java/com/statestreet/dao/AssessmentRepositoryImpl.java
...in/java/com/statestreet/dao/AssessmentRepositoryImpl.java
+32
-1
No files found.
src/main/java/com/statestreet/dao/AssessmentRepositoryImpl.java
View file @
685e773e
...
...
@@ -168,7 +168,8 @@ 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))));
...
...
@@ -201,6 +202,36 @@ 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
),
Criteria
.
where
(
"status"
).
is
(
CommonUtils
.
Assessment_Status
.
Assessment_Inprogress
))));
AggregationOperation
lookup
=
Aggregation
.
lookup
(
"Question_Set"
,
"_id"
,
"assessmentId"
,
"questionSet"
);
AggregationOperation
unwind
=
Aggregation
.
unwind
(
"questionSet"
,
true
);
Cond
condOperation1
=
ConditionalOperators
.
when
(
Criteria
.
where
(
"questionSet.isAttempted"
).
is
(
true
)).
then
(
1
).
otherwise
(
0
);
Cond
condOperation2
=
ConditionalOperators
.
when
(
new
Criteria
()
.
orOperator
(
Criteria
.
where
(
"questionSet.isAttempted"
).
is
(
true
),
Criteria
.
where
(
"questionSet.isAttempted"
).
is
(
false
)))
.
then
(
1
).
otherwise
(
0
);
AggregationOperation
project
=
Aggregation
.
project
(
"requestorName"
,
"requestorEcode"
,
"assessmentName"
,
"duration"
,
"location"
,
"createdDate"
,
"wrongUserId"
,
"misMatchUserId"
,
"completionDate"
,
"subLob"
,
"assessmentType"
).
and
(
"questionSet._id"
).
as
(
"setId"
)
.
and
(
condOperation1
).
as
(
"completedAssessment"
).
and
(
condOperation2
).
as
(
"totalAssessment"
).
and
(
"_id"
).
as
(
"assessmentId"
);
AggregationOperation
lookup1
=
Aggregation
.
lookup
(
"Quiz_Result"
,
"setId"
,
"questionSet._id"
,
"quizResult"
);
AggregationOperation
unwind1
=
Aggregation
.
unwind
(
"quizResult"
,
true
);
Cond
condOperation3
=
ConditionalOperators
.
when
(
Criteria
.
where
(
"quizResult.quizOutcome"
)
.
is
(
CommonUtils
.
Quiz_Status
.
Pass
)).
then
(
1
).
otherwise
(
0
);
Cond
condOperation4
=
ConditionalOperators
.
when
(
Criteria
.
where
(
"quizResult.quizOutcome"
)
.
is
(
CommonUtils
.
Quiz_Status
.
Fail
)).
then
(
1
).
otherwise
(
0
);
Cond
condOperation5
=
ConditionalOperators
.
when
(
Criteria
.
where
(
"quizResult.quizOutcome"
)
.
is
(
CommonUtils
.
Quiz_Status
.
Pending
)).
then
(
1
).
otherwise
(
0
);
AggregationOperation
project1
=
Aggregation
.
project
(
"assessmentId"
,
"requestorName"
,
"requestorEcode"
,
"assessmentName"
,
"duration"
,
"location"
,
"createdDate"
,
"wrongUserId"
,
"misMatchUserId"
,
"completionDate"
,
"completedAssessment"
,
"subLob"
,
"totalAssessment"
,
"setId"
,
"assessmentType"
)
.
and
(
condOperation3
).
as
(
"passCount"
).
and
(
condOperation4
).
as
(
"failCount"
).
and
(
condOperation5
).
as
(
"pendingCount"
);
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
);
AggregationResults
<
DBObject
>
result
=
template
.
aggregate
(
agg
,
COLLECTION
,
DBObject
.
class
);
log
.
debug
(
"Response returned from AssessmentRepositoryImpl -- getAssessmentName method, result={}"
,
result
);
return
result
.
getMappedResults
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment