Skip to content
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

App shows green icon when tracking is inactive #722

Merged
merged 2 commits into from
Apr 30, 2020
Merged

App shows green icon when tracking is inactive #722

merged 2 commits into from
Apr 30, 2020

Conversation

Krish023
Copy link
Contributor

@Krish023 Krish023 commented Apr 29, 2020

Linked issues:

Fixes #646

Screenshots:

How to test

@Krish023
Copy link
Contributor Author

Hi @tstirrat GetStoreData is an async method but it gets called as a sync method. There are two GetStoreData calls inside the checkIfUserAtRisk method. One is setting this.setState({ currentState: StateEnum.NO_CONTACT }) and another setting currentState: StateEnum.SETTING_OFF, . We can't be sure which will set the state first due to the async method. So I have checked inside one to another.

Copy link
Contributor

@tstirrat tstirrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh, good catch regarding the race condition!

Though, even with this change, it's still there. Can you eliminate 🐛 the race condition completely?

Move all of the checking logic inside:

GetStoreData(PARTICIPATE).then(isParticipating => {
  // move all other checks inside here
});

@Krish023
Copy link
Contributor Author

Ohhh, good catch regarding the race condition!

Though, even with this change, it's still there. Can you eliminate 🐛 the race condition completely?

Move all of the checking logic inside:

GetStoreData(PARTICIPATE).then(isParticipating => {
  // move all other checks inside here
});

Sure. I will change it

@kenpugsley
Copy link
Collaborator

Point of style ... can you please rename this PR to something meaningful. It's hard to keep track of which PR is which when we just reference another issue.

@tstirrat
Copy link
Contributor

Point of style ... can you please rename this PR to something meaningful. It's hard to keep track of which PR is which when we just reference another issue.

Yes !!! ^^^

We don't know what issue 123 is so don't make us do more work. We're already very busy

@Krish023
Copy link
Contributor Author

Point of style ... can you please rename this PR to something meaningful. It's hard to keep track of which PR is which when we just reference another issue.

Yes !!! ^^^

We don't know what issue 123 is so don't make us do more work. We're already very busy

I didn't get the above points. I have already mentioned the issue 646. Do I need to do any changes from my side?

@kenpugsley
Copy link
Collaborator

Point of style ... can you please rename this PR to something meaningful. It's hard to keep track of which PR is which when we just reference another issue.

Yes !!! ^^^
We don't know what issue 123 is so don't make us do more work. We're already very busy

I didn't get the above points. I have already mentioned the issue 646. Do I need to do any changes from my side?

Please don't take this the wrong way ... love the work you've done. But it is important that we have people follow the style of how PR's should be done. As Tim said, it's really about helping with the understandability of the PR. If the title of the PR says what it really is, then the reviewer doesn't have to spend time digging out the issue and figuring out what is going on, how to verify, etc. Remember that code reviewers are tracking multiple issues, so issue numbers get hard to remember. It's also much more helpful in the event we need to go back through PR's to figure out what went in, when, and possibly if we need to revert.

Here's an example of what you might have done on this pr (Looking at the discussion, you already ended up writing much of this in your first comment):

For the PR title
Fix LocationTracking race condition that causes incorrect state to be shown (Issue #646)

For the PR Description
GetStoreData is an async method but it gets called as a sync method. There are two GetStoreData calls inside the checkIfUserAtRisk method. One is setting this.setState({ currentState: StateEnum.NO_CONTACT }) and another setting currentState: StateEnum.SETTING_OFF, . We can't be sure which will set the state first due to the async method. So I have checked inside one to another.
... then include the linked issue as you did, plus a quick set of steps to test ...

@tstirrat
Copy link
Contributor

I didn't get the above points.

Oops, I made my comment without good explanation. Ken explained it way better, thanks :)

I think we can/should write a wiki or docs on this to make it clearer 😸

@Krish023
Copy link
Contributor Author

I didn't get the above points.

Oops, I made my comment without good explanation. Ken explained it way better, thanks :)

I think we can/should write a wiki or docs on this to make it clearer 😸

Noted:)

@tstirrat tstirrat changed the title #issue 646 App shows green icon when tracking is inactive Apr 30, 2020
@tstirrat
Copy link
Contributor

Tested on 2 x android emus and 1x iOS emu. Looks good.

@tstirrat tstirrat merged commit e063015 into Path-Check:develop Apr 30, 2020
tstirrat added a commit that referenced this pull request Apr 30, 2020
* develop:
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
tstirrat added a commit that referenced this pull request Apr 30, 2020
* develop: (22 commits)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
  Remove react-native-maps (#695)
  Fix e2e authority auto sub tests (#706)
  Fallback to English translations in e2e tests (#697)
  Add ja and fil languages (#700)
  Add a script to pull translations from lokalise (#641)
  Really really push to lokalise (#699)
  Run lokalize push on merge into develop (#698)
  ...
tstirrat added a commit that referenced this pull request Apr 30, 2020
* develop:
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
tstirrat added a commit that referenced this pull request May 2, 2020
* develop:
  Recommend PR best practices in PR template (#750)
  Add eslint react-hooks checks (#751)
  iOS: Added local notification in terminate function. (#521)
  Update dev README (#705)
  Better error logging in Google import (#703)
  Remove rebasing from suggestions in CONTRIBUTING.md (#724)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
tstirrat added a commit that referenced this pull request May 2, 2020
* develop: (60 commits)
  Recommend PR best practices in PR template (#750)
  Add eslint react-hooks checks (#751)
  iOS: Added local notification in terminate function. (#521)
  Update dev README (#705)
  Better error logging in Google import (#703)
  Remove rebasing from suggestions in CONTRIBUTING.md (#724)
  Translation refresh (#708)
  updated issue template (#729)
  Set up location after skiping the steps (#721)
  App shows green icon when tracking is inactive (#722)
  Fix postinstall script on Windows (#720)
  Fix isVersionGreater and add tests (#726)
  update the upgrade version to 1.0.0, to match what is in the master branch and avoid mistaken forced upgrades. (#723)
  1.0.1 (#715)
  Put GPS filter behind dev flag (#714)
  Fix headline1 text cutoff (#712)
  Put auto sub behind dev flags (#711)
  remove default news url from News.js constructor (#704)
  Fix i18n placeholder for authorities (#709)
  Remove react-native-maps (#695)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants