wizbots / labtab

0 stars 0 forks source link

Lab roster not syncing in labtab #114

Closed internetmosquito closed 5 years ago

internetmosquito commented 5 years ago

This is as a result of https://github.com/wizbots/wizbots/issues/2498

Which was confirmed by Dima as well.

How to reproduce:

This is clearly a problem, please check it out

kapoorutd commented 5 years ago

Hi @internetmosquito ,

I looked into the above issue and found that the followings...

  1. When we remove the student from the roster its get updated on web2.
  2. The data which we are getting from the api doesn't updated one.
  3. I have tested the api, after removing a student from the roster, In the api response I am getting the deleted student also. So that its seems that the data doesn't updating.
  4. After re-installing the app we are getting the same set of response, as I found in the api.
internetmosquito commented 5 years ago

@kapoorutd ok, let me review the API endpoint

alexey-ku77 commented 5 years ago

2. The data which we are getting from the api doesn't updated one.

I have received complain that there is bug in backend that makes api to return obsolete data. Is there is confirmation about this? For example log files where it clearly seen or code where is supposed to be refreshed? I have checked the labtab app. Looks like student list is fetched only once when program opened first time. When program opened second time - request is not made. I have also looked at the code - there is lines that makes observed behaviour to be looking true. Can you recheck it? @kapoorutd https://github.com/wizbots/labtab/blob/9b664e740e38f9aa00413aa686cc196448f0d617/app/src/main/java/org/wizbots/labtab/fragment/LabDetailsFragment.java#L164-L185 Gonna attach logs with annotations, what actions been made.

alexey-ku77 commented 5 years ago

first_launch.txt - this is when I first time looked program and checkout list of students. second_launch.txt - this is when app is restarted and students of same program are checked out.

kapoorutd commented 5 years ago

@alexey-ku77 @internetmosquito

As I pointed earlier the data which we are getting from the api doesn't updated one. Please have look into it..

I am requesting this Url to fetch the list of students for the selected program's sku. http://test.wizbots.com/api/programs/5a0a0f1f0d12a96355f421f7

And we are getting this Response...

{"absences":[{"date":"2018-06-13","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"58ec37d00d12a96cec49dccc"},{"date":"2018-06-13","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"598b51ec0d12a959bf5ab87f"},{"date":"2018-06-13","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"59a6dd120d12a911f0a85c11"},{"date":"2018-06-13","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"59a7a3640d12a911f0a85cd9"},{"date":"2018-06-13","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"5a31aff90d12a97018f71059"},{"date":"2018-06-01","mentor_id":"502ed74941af8c5f7c00000d","mentor_name":"Judy Cronin","student_id":"58ec37d00d12a96cec49dccc"}],"availability":"true","time_slot":"Wednesdays: 01:35PM to 03:05PM","category":"after_school_programs","ends":"04/04/18","grades":"3,4,5,6,7,8","id":"5a0a0f1f0d12a96355f421f7","location":"Charter Learning Center","name":"Robotics Lab","price":"252.0","room":"Room 22","season":"2018 - Winter","sessions":[{"end_time":"2018-01-31T15:05:00","start_time":"2018-01-31T13:35:00"},{"end_time":"2018-02-07T15:05:00","start_time":"2018-02-07T13:35:00"},{"end_time":"2018-02-14T15:05:00","start_time":"2018-02-14T13:35:00"},{"end_time":"2018-02-28T15:05:00","start_time":"2018-02-28T13:35:00"},{"end_time":"2018-03-07T15:05:00","start_time":"2018-03-07T13:35:00"},{"end_time":"2018-03-14T15:05:00","start_time":"2018-03-14T13:35:00"},{"end_time":"2018-03-21T15:05:00","start_time":"2018-03-21T13:35:00"},{"end_time":"2018-03-28T15:05:00","start_time":"2018-03-28T13:35:00"},{"end_time":"2018-04-04T15:05:00","start_time":"2018-04-04T13:35:00"}],"students":[{"id":"58ec37d00d12a96cec49dccc","lab_time":"124.0","level":"Wizard","name":"David Yurovitsky","pickup_instructions":"","stats":{"completed":6,"pending":5,"skipped":44},"special_needs":"Dyslexia","self_sign_out":false,"wizchips":141245},{"id":"598b51ec0d12a959bf5ab87f","lab_time":"39.0","level":"Imagineer","name":"Ezra Milbourne","pickup_instructions":"","stats":{"completed":6,"pending":11,"skipped":33},"special_needs":"","self_sign_out":false,"wizchips":55},{"id":"59a7a3640d12a911f0a85cd9","lab_time":"31.5","level":"Imagineer","name":"Georgie Levin","pickup_instructions":"","stats":{"completed":5,"pending":11,"skipped":34},"special_needs":"","self_sign_out":false,"wizchips":0},{"id":"59a6dd120d12a911f0a85c11","lab_time":"39.0","level":"Imagineer","name":"Hannah Miller","pickup_instructions":"","stats":{"completed":4,"pending":11,"skipped":35},"special_needs":"","self_sign_out":false,"wizchips":2},{"id":"5a31aff90d12a97018f71059","lab_time":"13.5","level":"Imagineer","name":"Harrison Herr","pickup_instructions":"","stats":{"completed":3,"pending":11,"skipped":36},"special_needs":"","self_sign_out":false,"wizchips":2},{"id":"4f2dbf72aea86268a8000000","lab_time":"13.5","level":"Novice","name":"Katie Criswell","pickup_instructions":"NA","stats":{"completed":0,"pending":0,"skipped":0},"special_needs":"","self_sign_out":false,"wizchips":2},{"id":"5a0c7f9c0d12a96353f41f26","lab_time":"22.5","level":"Imagineer","name":"Parker Klusas","pickup_instructions":"","stats":{"completed":3,"pending":11,"skipped":36},"special_needs":"","self_sign_out":false,"wizchips":6},{"id":"5a56916b0d12a92709c99e4e","lab_time":"22.5","level":"Imagineer","name":"Sammy Rozenfeld","pickup_instructions":"","stats":{"completed":3,"pending":11,"skipped":36},"special_needs":"","self_sign_out":true,"wizchips":1}],"starts":"01/31/18","sku":34705,"capacity":12}

It is showing 6 students for the same program's sku on the web but here we are getting 8 students in the app from above api url.

I am sharing the web screen shots for the same program sku in the below link

https://drive.google.com/open?id=1cWomqSIU6P-Ea_vhqsTlHFZ5zqAtKFBv

alexey-ku77 commented 5 years ago

As I pointed earlier the data which we are getting from the api doesn't updated one. Please have look into it..

Not sure if we on same page here. I am saying that I observed during labtab app testing that student list for program is obtained only once(when program is opened first time; code is below), thus using cached version of student list, which got obsoleted when student list is updated on server. I think labtab app need to make request to server every time the lab details is opened. @kapoorutd https://github.com/wizbots/labtab/blob/9b664e740e38f9aa00413aa686cc196448f0d617/app/src/main/java/org/wizbots/labtab/fragment/LabDetailsFragment.java#L164-L185

internetmosquito commented 5 years ago

@kapoorutd if you use the API itself, instead of labtab, and replicate the scenario, you can see API returns updated list, @alexey-ku77 correct me if I'm wrong but that's how I understand it

kapoorutd commented 5 years ago

@internetmosquito We have tired to reproduce the above scenario through API as well but still getting 8 entries in students whereas in website we have 5 entries. Below is the api Url we are using to fetch details against program through Postman. http://test.wizbots.com/api/programs/5a0a0f1f0d12a96355f421f7

Please find screenshot of api response and website response. Requested you to please check and confirm. screenshot from 2019-02-18 15 34 35 screenshot from 2019-02-18 15 35 19

alexey-ku77 commented 5 years ago

@kapoorutd test.wizbots.com used in postman and wizbots.com used in browser are different servers with separate databases. Please recheck you are using same server in postman, labtab app and in browser. Then ensure labtab updates list of students for certain program every time it opens LabDetailsFragment.

kapoorutd commented 5 years ago

@internetmosquito screenshot from 2019-02-18 18 56 48

Due to private connection warning, I am not able to login into test.wizbots.com. Please suggest how can we login?

alexey-ku77 commented 5 years ago

@kapoorutd admin:admin

alexey-ku77 commented 5 years ago

@kapoorutd have you managed to open staging web version of Wizbots? Can I help you with anything else?

kapoorutd commented 5 years ago

@alexey-ku77 @internetmosquito

I am trying to open the test.wizbots.com, But getting the 502 : Bad Gatetway error.. Attaching the screenshot

screenshot from 2019-02-19 10 14 00

alexey-ku77 commented 5 years ago

@kapoorutd You seeing But getting the 502 : Bad Gatetway error.. due to server upgrade.

alexey-ku77 commented 5 years ago

@kapoorutd staging should be fine now. please contact with me via slack if any problems. We need this get solved asap.

kapoorutd commented 5 years ago

@internetmosquito @alexey-ku77

Yes, It's working fine and I have checked-in the code in branch app_crash_ishu to solve the issue.

internetmosquito commented 5 years ago

@kapoorutd not sure I follow, are you saying you fixed the issue? Should I pull that branch and build labtab?

kapoorutd commented 5 years ago

@internetmosquito Exactly , Now the app will make request to server every time when the lab details is opened. Please pull app_crash_ishu branch and build labtab?

internetmosquito commented 5 years ago

@kapoorutd will do and update, thanks

alexey-ku77 commented 5 years ago

@kapoorutd I have few questions about changes you've made:

kapoorutd commented 5 years ago

@alexey-ku77

Please find my comments for the above questions as follows..

Are you sure your work with listeners are correct in Fragment lifecycle --> Ya GetProgramStudentsListener should be removed in onDestroyView method (Fixed Now) but OnSyncDoneListener implementation is done all arround in the project in the same way.

As I understand we still caching only initial version of students and fetches of fresh copy of students is not stored anywhere -->

We are making request to server every time when the lab details is opened, to get the updated list of students and then we are updating the database on the same time.

alexey-ku77 commented 5 years ago

@kapoorutd thank you for your feedback.

Ya GetProgramStudentsListener should be removed in onDestroyView method (Fixed Now)

In this commit I see that line with GetProgramStudentsListener is removed from onDestroy, but in comment you said about onDestroyView. I suppose its just a typo.

OnSyncDoneListener implementation is done all arround in the project in the same way.

I hope it was done in correct way all around.

We are making request to server every time when the lab details is opened, to get the updated list of students and then we are updating the database on the same time.

Yes. I found it. Thank you!

internetmosquito commented 5 years ago

Seems last version fixed the issue, but there are new issues