-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: Hide one-time completion self-report assessments after complete (M2-8164, M2-8026) #547
fix: Hide one-time completion self-report assessments after complete (M2-8164, M2-8026) #547
Conversation
In the web app, self-report assessments are identified and tracked using `targetSubjectId=null`. However, for past submissions, the BE returns the raw value of `targetSubjectId`, which is the subject ID of the respondent. These submissions needed to be normalized to have their `targetSubjectId` set to `null`, but to do so, needed to find out what the subject ID of the respondent (currently logged in user) is. So added a new `respondentMeta` property to the applet `base_info` endpoint on the BE, so that this value is now available to the FE to perform the needed equality comparison against `targetSubjectId`.
This pull request is automatically being deployed by Amplify Hosting (learn more). |
@farmerpaul I'm still seeing the activity showing up in the list in the web app (auto assign self report, set to once). I haven't figured out why, but I wanted to get it on your radar. Here's the applet I'm testing with: #!/usr/bin/env bash
set -e
# TODO: Update variables
email=""
password=""
api_base_url="https://localhost:8000"
login_response=$(curl "${api_base_url}/auth/login" \
-H 'Content-Language: en-US' \
-H 'Content-Type: application/json' \
-H 'Mindlogger-Content-Source: admin' \
-s --data-raw "{\"email\":\"${email}\",\"password\":\"${password}\"}"
)
access_token=$(echo "${login_response}" | jq -r '.result.token.accessToken')
workspace_id=$(echo "${login_response}" | jq -r '.result.user.id')
# Create the applet (password is P@$$w0rd)
curl "${api_base_url}/workspaces/${workspace_id}/applets" \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
-H "Authorization: bearer ${access_token}" \
-H 'Content-Type: application/json' \
-H 'Mindlogger-Content-Source: admin' \
-s --data-raw '{"displayName":"PR Review (M2-8164, M2-8026)","description":{"en":""},"themeId":null,"about":{"en":""},"watermark":"","link":null,"requireLogin":true,"pinnedAt":null,"streamEnabled":false,"streamIpAddress":null,"streamPort":null,"encryption":{"publicKey":"[230,108,192,157,208,114,160,247,169,212,128,158,214,246,148,243,251,137,235,202,179,64,156,128,8,82,80,247,32,142,174,81,102,45,138,151,130,172,78,113,189,23,78,39,186,208,252,33,102,35,131,81,242,174,147,127,157,48,170,90,9,41,80,64,189,67,226,17,242,3,18,242,12,125,252,136,160,165,250,100,165,216,49,214,215,89,54,240,252,131,80,214,82,101,113,206,100,115,114,194,80,127,104,118,89,136,58,93,175,152,160,126,140,59,248,246,118,194,221,107,176,34,254,222,40,85,102,87]","prime":"[253,248,90,120,216,246,31,0,226,134,172,248,90,126,42,170,135,32,92,167,238,239,74,222,63,141,186,19,103,129,104,7,141,209,83,14,233,199,228,186,51,243,154,131,20,88,62,110,0,98,166,179,48,30,251,158,104,43,186,6,182,97,171,72,67,65,129,143,95,139,196,6,203,49,62,161,253,135,191,60,71,105,229,68,39,33,204,82,152,249,237,11,110,208,245,162,51,231,223,128,216,220,79,180,181,244,249,43,191,147,246,133,174,247,236,154,73,231,146,248,194,21,144,154,105,101,123,91]","base":"[2]","accountId":"7b6c97c7-d06f-4ccb-819c-9cfd783c8fde"},"activities":[{"name":"Auto Assign Activity (once)","description":{"en":""},"showAllAtOnce":false,"isSkippable":false,"responseIsEditable":true,"isHidden":false,"autoAssign":true,"isReviewable":false,"items":[{"name":"CodingZen","question":{"en":"Debug the code, refine the process, trust the journey."},"responseType":"message","responseValues":null,"config":{"type":"message","removeBackButton":false,"timer":0},"allowEdit":true,"isHidden":false}],"scoresAndReports":{"generateReport":false,"showScoreSummary":false,"reports":[]},"key":"dc8d5f4d-d093-4262-b708-c5ff5bf13a28","reportIncludedItemName":""},{"name":"Auto Assign Activity (daily)","description":{"en":""},"showAllAtOnce":false,"isSkippable":false,"isReviewable":false,"responseIsEditable":true,"isHidden":false,"scoresAndReports":{"generateReport":false,"showScoreSummary":false,"reports":[]},"reportIncludedItemName":"","autoAssign":true,"items":[{"name":"CodingZen","question":{"en":"Debug the code, refine the process, trust the journey."},"responseType":"message","responseValues":null,"config":{"type":"message","removeBackButton":false,"timer":0},"allowEdit":true,"isHidden":false}],"key":"5c45f7b7-e5ad-4512-a4e9-6b0be39c8c49"},{"name":"Manual Assign Activity (once)","description":{"en":""},"showAllAtOnce":false,"isSkippable":false,"isReviewable":false,"responseIsEditable":true,"isHidden":false,"scoresAndReports":{"generateReport":false,"showScoreSummary":false,"reports":[]},"reportIncludedItemName":"","autoAssign":false,"items":[{"name":"CodingZen","question":{"en":"Debug the code, refine the process, trust the journey."},"responseType":"message","responseValues":null,"config":{"type":"message","removeBackButton":false,"timer":0},"allowEdit":true,"isHidden":false}],"key":"8adf3237-3475-4583-b654-24be50548c34"},{"name":"Manual Assign Activity (daily)","description":{"en":""},"showAllAtOnce":false,"isSkippable":false,"isReviewable":false,"responseIsEditable":true,"isHidden":false,"scoresAndReports":{"generateReport":false,"showScoreSummary":false,"reports":[]},"reportIncludedItemName":"","autoAssign":false,"items":[{"name":"CodingZen","question":{"en":"Debug the code, refine the process, trust the journey."},"responseType":"message","responseValues":null,"config":{"type":"message","removeBackButton":false,"timer":0},"allowEdit":true,"isHidden":false}],"key":"8049dac5-29cc-4871-bb76-3d22fec962eb"}],"activityFlows":[{"name":"Auto Assign Flow (once)","description":{"en":"Auto Assign Flow"},"isSingleReport":false,"hideBadge":false,"reportIncludedActivityName":"","reportIncludedItemName":"","isHidden":false,"autoAssign":true,"items":[{"activityKey":"dc8d5f4d-d093-4262-b708-c5ff5bf13a28"},{"activityKey":"8adf3237-3475-4583-b654-24be50548c34"}]},{"name":"Auto Assign Flow (daily)","description":{"en":"Auto Assign Flow"},"isSingleReport":false,"hideBadge":false,"reportIncludedActivityName":"","reportIncludedItemName":"","isHidden":false,"autoAssign":true,"items":[{"activityKey":"dc8d5f4d-d093-4262-b708-c5ff5bf13a28"},{"activityKey":"8adf3237-3475-4583-b654-24be50548c34"}]},{"name":"Manual Assign Flow (once)","description":{"en":"Manual Assign Flow"},"isSingleReport":false,"hideBadge":false,"reportIncludedActivityName":"","reportIncludedItemName":"","isHidden":false,"autoAssign":false,"items":[{"activityKey":"dc8d5f4d-d093-4262-b708-c5ff5bf13a28"},{"activityKey":"8adf3237-3475-4583-b654-24be50548c34"}]},{"name":"Manual Assign Flow (daily)","description":{"en":"Manual Assign Flow"},"isSingleReport":false,"hideBadge":false,"reportIncludedActivityName":"","reportIncludedItemName":"","isHidden":false,"autoAssign":false,"items":[{"activityKey":"dc8d5f4d-d093-4262-b708-c5ff5bf13a28"},{"activityKey":"8adf3237-3475-4583-b654-24be50548c34"}]}]}' I've created a participant, assigned the manual ones to them, then scheduled them as their names suggest. Then I:
|
@sultanofcardio It looks like the BE didn't deploy successfully the first time (some AWS service not being "stable") so I re-ran it about 15 minutes ago and I think it's still going. So the BE might not be returning |
I checked out the branch and am testing locally. I confirmed that the BE is returning the |
Thanks for the script! I recreated the applet and set up activity schedules, and was able to reproduce – but only for the daily-scheduled activities. The one-time activities are working fine after logging out and back in. I'll see what I can find out. |
Depending on your time zone and the time of day, the date returned by the submissions endpoint could have been parsed incorrectly using the previous approach. As a result, previous same-day submissions were being interpreted as having occurred on the previous day and resulting in daily activities showing when they shouldn't be. Fixed this using a simpler and time zone-safe parsing method.
@sultanofcardio can you test again? I still haven't been able to reproduce your bug with one-time completion activities, only daily scheduled activities, but I think I fixed it for the daily scenario. |
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.
Looks like it was fixed by the timezone change. I suspect that we may run into a few more of those
📝 Description
🔗 Jira Ticket M2-8164
🔗 Jira Ticket M2-8026
In the web app, self-report assessments are identified and tracked using
targetSubjectId === null
. However, for past submissions, the BE returns the raw value oftargetSubjectId
, which is the subject ID of the respondent. These submissions needed to be normalized to have theirtargetSubjectId
set tonull
. But for the web app to know which submissions are self-reports, we needed to find out what the subject ID of the respondent (currently logged in user) is for the current applet.This entailed adding a new
respondentMeta
property to the appletbase_info
endpoint on the BE (ChildMindInstitute/mindlogger-backend-refactor#1646), which is the endpoint the web app is already using to fetch the basic info for the applet to render the main activities/flows list. Now this value is available to the Web App to perform the needed equality comparison againsttargetSubjectId
, and normalize it tonull
accordingly.Note
To test this, you need to use the Web App connected to this PR's branch of the BE repo.This is now been merged, so no special steps are needed here.🪤 Peer Testing
Preconditions:
Steps (M2-8164):
Expected outcome: The self-report assignment should no longer be present in the list.
Steps (M2-8026):
Expected outcome: The self-report assignment should not be present in the list.