ChildMindInstitute / mindlogger-app

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

There are delays on old account on processing the activity #2596

Open natalia-muzyka opened 2 years ago

natalia-muzyka commented 2 years ago

Delays are reproduced on all the activities (no matter what the item/activity type)

1 - delay on opening the activities 2 - sometimes after error I can't continue drawing from the first tap 3 - after completing trail there is a delay after tapping the next/done button

video 1: https://www.screencast.com/t/87K6Hx65 video 2&3: https://www.screencast.com/t/fEfPRR4B

ML v0.20.2 staging ML v0.20.4 staging iPad Pro 10.5 / iOS 15.3 iPhone XR / iOS 14.3 Pixel 5 / Android 11

reproducible on account with a big amount of applets: jeraka1732@wodeda.com 1234567890

NOT reproducible on the newer account with up to 15 applets: ml_general_acc@protonmail.com 12345678

WorldImpex commented 2 years ago

@mtg137 Here is a video of a production account having similar issues

https://images.zenhubusercontent.com/103405139/326db7eb-0036-475f-a918-fe3c8ffbbe55/ipadtrails_notacceptingstylustouch.m4v

natalia-muzyka commented 2 years ago

@mtg137 there are still delays while processing the activities. The app crashed while processing the activity:

Not reproduced on account with up to 35 applets: qwe123@qwe123.qwe123 / qwe123

Environment: ML v0.20.12 staging iPhone XR // iOS 14.3 Samsung Galaxy S7 // Android 8 Google Pixel 5a // Android 11 iPad Air 2 WiFi // iOS 14.6 Apple iPad 9th gen (2021) / iOS 15.5

natalia-muzyka commented 2 years ago

Videos from our stakeholders for A/B Trails task:

  1. https://drive.google.com/file/d/1zp4817At03Zu_H-m0UXU0Gui7YgS7vjv/view
  2. https://images.zenhubusercontent.com/103405139/326db7eb-0036-475f-a918-fe3c8ffbbe55/ipadtrails_notacceptingstylustouch.m4v
anq83 commented 2 years ago

@natalia-muzyka Need to update the mentioned users / accounts in order to reproduce It seems data inside them obsoleted (applets are not refreshed at all, we get error id = undefined for activities)

natalia-muzyka commented 2 years ago

@anq83

1 - delay in opening the activities 3 - after completing trail there is a delay after tapping the next/done button

Noticed that the delay issue(in general, not only in a/b trails activity) depends on the number of applets on the account + device.

Here are my test results: iPhone 7 // iOS 13.1.1 - delays even if there are up to 10 applets on account, and if there are 25-30 applets then delays become more explicit Video: https://www.screencast.com/t/FRuESsTCnt

iPhone 13 // iOS 15.6 - no delays Video: https://www.screencast.com/t/vcCQSELSSju

Google Pixel 5a // Android 11 - micro delays even if there are up to 10 applets on account, and if there are 25-30 applets then delays become more explicit Video: https://www.screencast.com/t/08vglRLr

Continue investigating #2

Environment: ML v0.21.54 staging ML v0.21.57 staging accounts: geria2.test@gmail.com / McgzF127 (old account, up to 25 applets) applet: All activities new_user@ml.com / 123456 (new account, up to 10 applets) applet: Applet geria.test@yahoo.com / 3FuuFz60 (old account, up to 30 applets)

anq83 commented 2 years ago

@natalia-muzyka thanks, what about hangs mentioned above from stakeholders?

yzenchanka commented 2 years ago

The issue "Sometimes after error I can't continue drawing from the first tap" is reproduced It seems to happen when the user doesn't tap exactly on the dot Environment: ML v 0.21.57 (staging) Samsung Galaxy S20 FE SM-G780G // Android 12 iPhone 7+ DM // iOS 14.4.1 Google Pixel 3 Xl // Android 10 iPad 7 Gen // iOS 15.4/1 Account: geria.test@yahoo.com / 3FuuFz60 (old account, up to 30 applets) New applet test https://images.zenhubusercontent.com/103405139/39bff8be-27a3-47e9-b80a-98aca75ee952/az_recorder_20221108_123759.mp4

natalia-muzyka commented 2 years ago

@anq83

Lines are not displayed after the first valid attempt. Sometimes it looks like if you don't tap directly at the point, but your tap is a little bit out of the point's area, then the line is not drawn.

I have two suggestions, they aren't related to delays, but might worth to check:

1 - may there be an error if the new line doesn't cross the old one? image.png

2 - may there be a difference in the actual point's area and the area that we see? image.png

Also, please, take a look at my video of processing Trails activity: https://www.screencast.com/t/hR8Abo2Aa2

Environment: ML v 0.21.57 (staging) Google Pixel 5a // Android 11 iPhone 13 // iOS 15.6 iPhone 7 // iOS 13.1.1 Samsung Galaxy S7 // Android 8 geria2.test@gmail.com / McgzF127 (old account, up to 25 applets) applet: All activities

anq83 commented 2 years ago

Re. micro-lags when tap on applet or on activity or when switch from one screen to another:

The reason is redux state size. It doesn't depend on redux-persist setting. Only - how fast js handles redux actions and updates parts of state. It doesn't even depend on which substate handled whether app or applets. No matter. Only on size of overall state. For example: simple test: in the function downloadApplets, the row dispatch(replaceApplets(transformedApplets)); change to dispatch(replaceApplets([transformedApplets.pop()]));

Then we get only 1 applet in the state => state's side 10+ times less => we don't get lags anymore.

The solution: I suggest do not do anything in the current version (before refactoring) because it tightly coupled with redux persist and it assumes that all applets exist in the state. Redux state should be analyzed carefully and optimized. After refactoring we can change this approach: e.g. load only current applet from async storage and save it in redux. Disable redux-persist. This way we'll get size of redux significally less. We also could make background app-refresh when app is closed and manage redux more carefully and correctly.

anq83 commented 2 years ago

Re.lags - @natalia-muzyka updated her comment above - the most long delay seems to be ~2 sec. The same as I caught.

anq83 commented 2 years ago

Re. 2nd issue in scope of this ticket - when touch down in the circle - line is not drawn.

The issue wasn't reproduced in the provided videos above from QAs indeed.

I've watched these videos in slow-mo. When touch-down - the center of touch light-grey-round is outside of black round on canvas. So, this is correct that line is not drawn in such cases.

The videos provided from stakeholder - differ. We can see that stilus is inside black round and line is not drawn.

I've also checked mathematics of the component, debugged it for every black-canvas-round, for different round sizes, checked it on pixel 3xl, on simulators iProne 7, iPad Pro - mathematics is correct, touch inside black-rounds registered correctly:

const distance = Math.sqrt(
        Math.pow(item.cx * rate - locationX, 2) +
          Math.pow(item.cy * rate - locationY, 2)
      );

      if (distance <= screen.r * rate + 2) { // touch inside black round success, 2 - is round border - it's ok.
...

Btw. you cannot touch outside the black round and just cross it - it will not work and this is also correct.

The only thing for now I'd suggest to check - when moving line - 50-100 tcp socket requests may be sent when this setting is on and as we know js thread is single, so that might be the reason:

image.png

natalia-muzyka commented 2 years ago

@anq83 I checked the case with the Live connection turned ON and see some issues with the drawing. But it might look like something not related to the stakeholders' issues, so I created a new ticket in JIRA: https://mindlogger.atlassian.net/browse/MIN-60 Waiting for updates from @iradchenk0 tomorrow.

anq83 commented 2 years ago

Comment from @binarybottle image.png

natalia-muzyka commented 1 year ago

@anq83 @iradchenk0 recorded for us two videos on his iPad with Apple pencil. It seems that the delay issue is related to the stylus. When Ivan can't draw a line with the stylus, then he can draw it with a finger. Live connection option is OFF.

Video 1: https://www.screencast.com/t/U7aYjYr0 Video 2: https://www.screencast.com/t/pNAgzCpjlL2U

ML v0.21.54 staging

geria2.test@gmail.com / McgzF127 (old account, up to 25 applets) applet: All activities

qwe123@qwe123.qwe123 / qwe123 applet: Cognitives / Trails iPad

@iradchenk0 add, please, your device details (model, iOS version, Apple pencil gen)

iradchenk0 commented 1 year ago

Video recorded in such environment: Apple iPad Pro 10,5 (MPDY2NF/A) iOS 15.1 Apple pencil gen 1

natalia-muzyka commented 1 year ago

Moved trails issue with apple pencil to the new ticket in JIRA: https://mindlogger.atlassian.net/browse/ML-202