HASEL-UZH / PersonalAnalytics

Personal Analytics project to increase knowledge workers' awareness about work and productivity.
https://hasel.dev/project/individual-productivity/
Other
56 stars 18 forks source link

Don't start/stop biometrics tracker if the settings are changed and PA is in pause mode #138

Closed s-mueller closed 7 years ago

ghost commented 7 years ago

the fix checks the "IsRunning" property to find out whether PA is in pause mode. But actually, "IsRunning" only says if the current tracker is running or not, and not whether PA is in pause mode. Currently, we don't have such a poperty.

--> we need to find a nice way to solve this issue --> and fix the problems introduced with the original fix (which is that the biometric trackers don't start when they are enabled in the settings window)

s-mueller commented 7 years ago

I tried to reproduce this issue but couldn't. Here is what I did:

1) Start PA with Fitbit Tracker running 2) Disable Fitbit Tracker and make sure that Fitbit Tracker is not running 3) Pause PA and make sure that all trackers are not running 4) Enabled Fitbit Tracker in the settings and make sure that Fitbit Tracker is still not running 5) Resume PA and make sure that Fitbit Tracker is running.

Isn't that the desired behaviour? Or what do I need to change to reproduce the issue?

ghost commented 7 years ago

Hey @s-mueller ,

The problem is when you do it the other way:

  1. start PA with Fitbit Tracker DISABLED
  2. ENABLE FitbitTracker (PA is NOT paused)
  3. FitbitTracker does not start but it should.

Log from output window: Fitbit Tracker is now enabled Query: The participant updated the setting 'FitbitTrackerEnabled' to True Don't do anything, tracker is paused

The way it is implemented now, it just never starts when it is enabled, because it checks whether the FitbitTracker is running, but it is never running when it was disabled before. The IsRunning property doesn't tell us whether PA is in pause mode or not, it just tells us whether the Fitbit Tracker is currently running. So currently, we need to restart PA after enabling one of the biometrics trackers to actually start it.

s-mueller commented 7 years ago

@manulita Thanks, now I understand the problem. I think I agree with you, we would either need a global property that indicates whether PA is paused or not, or we can't implement this feature as planned. Then we would have to enable FitbitTracker even if PA is paused. @casaout What do you think?

s-mueller commented 7 years ago

In the TrackerManager class there is the _isPaused field that we could use for that. However, since the Trackers don't know the PersonalAnalytics project and since we shouldn't change that, things are getting a little bit more complicated. We could send an event from the PersonalAnalytics project to all trackers announcing pausing and resuming events. Or we send an event to the Shared project that keeps then a copy of the pause status and trackers can call a method in the Shared project to check whether PersonalAnalytics is paused.

s-mueller commented 7 years ago

@manulita Fixed in the dev branch. Please test. If okay, I'll cherry-pick to other branches.

s-mueller commented 7 years ago

Applied fix also to master branch