rob729 / Quiet_Hours

No more trouble to make silent mode ON/OFF manually every time.
3 stars 9 forks source link

Fix Bug in Pause/Resume Feature #66

Closed coder2699 closed 3 years ago

coder2699 commented 3 years ago

Describe the bug Right now there's a bug in pause/resume profile feature. Consider you have a profile(Pro A) running, and there's another profile(Pro B) present for other day having starting time between the time of activity of active profile. When the start time of profile B becomes equal to the current time, the sharedpreference value stored in the ACTIVE_PROFILE_ID stores id of Profile B (where ideally it should have stored id of Profile B). When end time of profile A triggers, it does not ENDS because of the change in value of ACTIVE_PROFILE_ID.

To Reproduce

  1. Create Profile A (Start: 08:25AM ; End: 08:35AM ; DaySelected: Monday(current day))
  2. Create Profile B (Start: 08:27AM ; End: Take any(does not matter) ; DaySelected: Wednesday)
  3. For better reference add a Toast displaying value of ACTIVE_PROFILE_ID
  4. Observe that at 08:27AM, value stored in ACTIVE_PROFILE_ID changes (from id of A to id of B)

This change in value of ACTIVE_PROFILE_ID will create trouble if you further try to pause/resume profile A (after 8:27AM)

Expected behavior

In the above scenario given since Profile B must be active on Wednesday, so on Moday at 8:27AM, value of ACTIVE_PROFILE_ID must store id of profile A & not B

Would you like to work on the issue?

coder2699 commented 3 years ago

@rob729 I was trying to find any shortcomings in the pause/resume feature and found this. I want to fix it, if you approve this issue.

coder2699 commented 3 years ago

@rob729 I first pulled the changes from your master branch to my development branch. So this PR got closed. But now when I have made 2 commits in my development branch it is still not allowing me to reopen this PR (Earlier i had used the same method for other PRs and I was able to reopen)

If it has to be open from your end, please open it. Otherwise tell me what shall i do?