ChildMindInstitute / mindlogger-app

MindLogger (React Native) data collection app
Other
15 stars 6 forks source link

Timer is not shown up in the flow activity #2808

Closed natalia-muzyka closed 1 year ago

natalia-muzyka commented 2 years ago

Preconditions The user is logged on admin panel There is the applet with activity flow The mobile app is installed and launched There is the scheduled flow with the timer option enabled

Steps to reproduce

  1. Log in to the app
  2. Proceed to the scheduled flow
  3. Start the flow
  4. Pay attention to the activity screen

Actual result Timer is not shown up in the flow activity

Expected result Timer is shown up in every activity within the flow on the top left of the activity(item) screen. After the time is up:

Video: https://www.screencast.com/t/XhoarXMo7YVt

@WorldImpex please, advise, on how it should work. I assume after the timer is finished:

Environment: ML v0.21.42 staging iPhone 7 // iOS 13.1.1 Google Pixel 5a // Android 11 user-stg@ml.com / 123456 config reports v11 / particular day flow Applet password Qwe123!!!

WorldImpex commented 2 years ago

That is correct @natalia-muzyka

natalia-muzyka commented 2 years ago

Still reproducible.

image.png

Environment: iPhone 7 // iOS 13.1.1 Google Pixel 5a // Android 11 ML v0.21.48 staging user-stg@ml.com / 123456 config reports v11 / one-time completion flow ML v0.21.48 prod test-user1@com.us schedule flows / my flow 2 timer Applet password Qwe123!!!

anq83 commented 1 year ago

Here's requirement in the description: "OR The "Report summary" screen is shown if this is the last activity in the flow and there is the Summary screen allowed on the builder side. Responses are submitted."

The thing is - it hasn't been implemented for a single activity. When timer or idle option in schedule - associated with a single activity - no logic for moving to summary screen at all. So, I cannot spread such logic to activity flow.

To implement it from scratch - high probability of regression. Current inrernals not suitable for this. The logic for handling time-off is not in the activity component. It's in the async redux-thunk. Whereas logic for moving to summary is in the Activity. So, significant changes would be. Rewrite part of functionality. Refactoring before it. Maybe, there's solution how to do it safely without such changes. But it will take more time for review (1-2days). Discussed with @natalia-muzyka We're going to complete this one without the mentioned point. To move this point to separated task.

Also, it worth to mention that currently when time is off bor both: idle and timer - the completeResponse logic will work. It contains the logic for uploading response data to server.

Also, when summary screen is shown I suppose (this one to re-check) - the completeResponse will also work when user clicks on button next. So, if to show summaryScreen then it's possible to get completeResponse working twice.

@binarybottle @WorldImpex @natalia-muzyka

anq83 commented 1 year ago

The comment above is actual for 2807 as well (idle schedule)

natalia-muzyka commented 1 year ago

@binarybottle @WorldImpex I want to make sure that we are on the right way and interpreted a requirement for idle time / timer correct:

1 - when admin sets an idle time or timer, this setting should be applied to every activity in the flow, right? So if there is the 2 minutes timer added to the event, then user has 2 minutes for every activity?

2 - if #1 is yes, then after completing the timer / idle time, if activity in the flow has a visible report do we want to show the report first and let the user complete activity, or do we want to complete the activity and move to interim / thanks screen with skipping the Report summary screen?

Requirements: https://app.zenhub.com/workspaces/mindlogger-5e11094d0c26311588da9626/issues/childmindinstitute/mindlogger-admin/1552 image.png

anq83 commented 1 year ago

Please review tech. details above @natalia-muzyka message

anq83 commented 1 year ago

Current fix will work this way: For activity flow:

  1. for “Idle for activity” logic (sets in schedule): when time is over - user skipped to interim screen and starts next activity in flow, idle counter resets (starts again)
  2. for ’Timer for activity” logic (sets in schedule): when time is over - user skipped to “Time is up!” screen and flow terminated. Because this timer spreads to the whole flow.
anq83 commented 1 year ago
  1. for both 1 and 2: summary (report) screen is not shown, but responses uploaded (completeResponse thunk function). tech details why so - see above
WorldImpex commented 1 year ago

@anq83 I think this is a fine first version

natalia-muzyka commented 1 year ago

Verified as fixed. When time is over - user skipped to “Time is up!” screen and flow terminated. Timer spreads to the whole flow.

Environment: ML v0.21.57 iPhone 13 // iOS 15.6 Google Pixel 5a // Android 11