-
Notifications
You must be signed in to change notification settings - Fork 8
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
feature: New endpoint to return total counters for subject (M2-7889) #1669
Conversation
@Phillipe-Bojorquez New endpoint |
➡️ Preview environment failed to be destroyed |
❌ E2E tests failed |
78b07be
to
f083e6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few initial comments, but I have more to add, just getting these out 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary testing
@rcmerlo @farmerpaul can we align on the property semantics, to make sure this endpoint is being developed, tested and integrated with the same understanding? Do the following Definitions align with your understanding?
Dec 3: Definitions and test results updated after aligning with @farmerpaul's comment below.
Definitions
respondentActivitiesCount
/respondentActivitiesCountExisting
: Total number of Activities/Flows that have ever been completed by participant or have been assigned to this participant as the respondent.targetActivitiesCount
/targetActivitiesCountExisting
: Total number of Activities/Flows that have ever been completed about participant or have been assigned to this participant as the target.respondentsCount
: Total number of respondents that have completed the activity/flow about the participant or are assigned the activity/flow as a respondent about the participantsubjectSubmissionsCount
: Total number of submissions completed about the participant for this activity/flowsubjectsCount
: Total number of subjects the participant has completed the activity/flow about or the participant is assigned to as a respondent for the activity/flowrespondentSubmissionsCount
: Total number of submissions the participant has completed for this activity/flow
Tests
Dec 3
- 1 flow (not auto assigned)
- 3 activities (2 auto assigned, 1 manually assigned)
Property | Expected | Actual | Result |
---|---|---|---|
respondentActivitiesCount |
2 | 2 | ✅ |
targetActivitiesCount |
2 | 2 | ✅ |
- completed the first auto-assigned activity
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
3f6c92ef | 3f6c92ef | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
1 | 1 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
1 | 1 | ✅ |
- completed the first auto-assigned activity again
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
3f6c92ef | 3f6c92ef | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
2 | 1 | ❌ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
2 | 1 | ❌ |
- added limited account subject
- Performed Take Now on first auto-assigned activity for limited account
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
3f6c92ef | 3f6c92ef | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
3 | 2 | ✅ (mismatch due to previous test) |
subjectsCount |
2 | 2 | ✅ |
subjectSubmissionsCount |
2 | 1 | ✅ (mismatch due to previous test |
- Performed Take Now on manually assigned (currently unassigned) activity for limited account
Property | Expected | Actual | Result |
---|---|---|---|
respondentActivitiesCount |
3 | 2 | ❌ |
targetActivitiesCount |
2 | 3 | ❌ |
activityOrFlowId |
96adf4c0 | 96adf4c0 | ✅ |
respondentsCount |
0 | 0 | ✅ |
respondentSubmissionsCount |
1 | 1 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
0 | 0 | ✅ |
Dec 5
- 1 flow (not auto assigned)
- 3 activities (2 auto assigned, 1 manually assigned)
Property | Expected | Actual | Result |
---|---|---|---|
respondentActivitiesCountExisting |
2 | 2 | ✅ |
targetActivitiesCountExisting |
2 | 2 | ✅ |
- completed the first auto-assigned activity
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
c979189136f3 | c979189136f3 | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
1 | 1 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
1 | 1 | ✅ |
- completed the first auto-assigned activity again
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
c979189136f3 | c979189136f3 | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
2 | 2 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
2 | 2 | ✅ |
- added limited account subject
- Performed Take Now on first auto-assigned activity for limited account
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
c979189136f3 | c979189136f3 | ✅ |
respondentsCount |
1 | 1 | ✅ |
respondentSubmissionsCount |
3 | 3 | ✅ |
subjectsCount |
2 | 2 | ✅ |
subjectSubmissionsCount |
2 | 2 | ✅ |
- Performed Take Now on manually assigned (currently unassigned) activity for limited account
Property | Expected | Actual | Result |
---|---|---|---|
respondentActivitiesCountExisting |
3 | 3 | ✅ |
targetActivitiesCountExisting |
2 | 2 | ✅ |
activityOrFlowId |
15e2486d5d3e | 15e2486d5d3e | ✅ |
respondentsCount |
0 | 0 | ✅ |
respondentSubmissionsCount |
1 | 1 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
0 | 0 | ✅ |
- Assigned manual flow to participant for limited account
Property | Expected | Actual | Result |
---|---|---|---|
respondentActivitiesCountExisting |
4 | 4 | ✅ |
targetActivitiesCountExisting |
2 | 2 | ✅ |
- Completed flow for limited account
Property | Expected | Actual | Result |
---|---|---|---|
activityOrFlowId |
f03f9d63708f | f03f9d63708f | ✅ |
respondentsCount |
0 | 0 | ✅ |
respondentSubmissionsCount |
2 (TBC) | 2 | ✅ |
subjectsCount |
1 | 1 | ✅ |
subjectSubmissionsCount |
0 | 0 | ✅ |
Hi Marty, thanks for doing all that testing and sharing your results in such detail. I've been seeing similar results locally. I think two of the definitions you listed above I would have interpreted differently:
I think in the code, it's the submissions completed by the participant. "respondent" here is suggesting that the passed subject is the respondent.
And conversely, what's being calculated here is submissions completed about the participant, "subject" here suggesting that the passed subject is the target subject. |
@farmerpaul thanks, glad we can get on the same page. I wavered back and forth between guessing what each meant. I ultimately thought I'll flip the definitions and test results in my comment above to align with how you and @rcmerlo defined these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rcmerlo, I've been working on some of the remaining discrepancies in the results returned by this endpoint, and I've come up with 3 fixes. (These fixes are needed in addition to what you're currently working on with respect to activities/flows that only have assignments, and no submissions.)
You should just be able to plug these fixes into your current PR. Let me know if you have any questions!
@mbanting @farmerpaul I did a big refactoring in code to get correct data, I'm still working on automated tests, but please check again |
d022b47
to
7c7a88c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discovered a few more issues around deleted subjects, see comments below.
Also, there's something else that seems to be a problem since your last change; all the submissions counts are now coming back as either 0 or 1 for me. I haven't dug down as to what's going on there…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My last 2 comments for now! Let me know if you have any questions…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just discovered there's an issue with the total activites count on the By Participant tab for limited accounts – investigating!
Good question, @mbanting. I'd actually assumed each flow submission should count as "1" in each of the submissions counts, but now I'm not so sure. If you go to the Applet Overview tab, then it appears that submissions are only listed on the activity level, not the activity flow level. In fact, there's not even any mention of submitted activity flows on the Applet Overview tab, which doesn't really make a whole lot of sense to me. Shouldn't it be recorded somewhere that the flow was also completed? Hmm… I'm checking again now, and it appears that the endpoint used to list the expanded view of activity flows on the By Participant tab treats each flow submission as "1 submission" – that is, the submissions column of the expanded view for activity flows is not adding up to the total count of submission for the activity flow as a whole (coming from the metadata endpoint). These numbers need to align, as to have those counts not add up is very confusing, and QA would definitely have a problem with it!
After chatting with @rcmerlo more, I felt it made more sense to count unique |
Co-authored-by: Farmer Paul <[email protected]>
… activity listing
Co-authored-by: Farmer Paul <[email protected]>
Co-authored-by: Farmer Paul <[email protected]>
2008eac
to
e9e5282
Compare
e9e5282
to
05008b5
Compare
For all the PDP queries, a "submission" for a flow should only be **completed** ones. A flow that has only been partially completed (say, only the 1st activity of 5 activities have been submitted) should not count towards having any submissions, and thus should NOT be: - listed on the PDP pages for the associated subjects - included in the tallying of activities/flows for that tab - included in the submissions count on the flow level within each tab - included in that flow's expanded view's submissions counts
After discussions with product, it was agreed that a "submission" for a flow = a completed assessment of that flow, where all activities contained in that assessment were submitted. This corresponds to records in the With my latest commit, all these endpoints should now be taking this into consideration in their querying against the
So for example, if you create a new activity flow with 2 activities, and it's unassigned (not auto-assigned nor manually assigned), and you do Take Now but only complete the 1st activity, it should NOT be listed on the PDP for the associated subject. Nor should any other such partial activity flow "submissions" count towards the totals shown on the PDP. I've confirmed locally but feel free to do further testing. We should probably add specific unit tests for this as well (@rcmerlo feel free to take this on when you get back 😅🙏🏻). |
📝 Description
🔗 Jira Ticket M2-7889
New endpoint
/activities/applet/{applet_id}/subject/{subject_id}/metadata
to return activities metadata for subjects as target and respondent, including a list of activities with submissions counts and subjects counts