vmiklos / plees-tracker

Plees Tracker is a simple sleep tracker for your Android phone.
https://vmiklos.hu/plees-tracker/
MIT License
151 stars 38 forks source link

Start Time not saved after change without comment #253

Closed gadgetguy08 closed 2 years ago

gadgetguy08 commented 2 years ago

Version 7.3

Reproducer steps

  1. Press Start, press stop (to enter time where start had not been pressed earlier )
  2. Change start time to earlier time.
  3. Click OK

Actual result Time isn't saved.

Occasionally message shows briefly that says something like 'Start time is not before stop time. Not saved' It is quick and not all the time, but change is not saved.

IF a comment is entered , time change is saved.

Expected behavior

Changing start time should be saved without comment.

vmiklos commented 2 years ago

Hmm, this after-the-fact editing is not working for me even with comments. I'll see what can I do.

Eyap53 commented 2 years ago

First thank you for this wonderful app !

Then, I also got this bug and decided to investigate. It seems like each time the user update the date (start or stop), the comment field also send an update (with the old references, thus reverting the change).

This behavior comes from the addTextChangedListener that is not unsuscribed, and then called after the date change by comment.setText(sleep.comment), in SleepViexModel.kt.

I will push a PR soon :)

Columbus240 commented 2 years ago

I just came across the same problem in v7.3.0 and noticed the following detail. Steps to reproduce:

  1. Create a new sleep entry, by starting & stopping the tracker.
  2. Click on the entry to edit it.
  3. Change the starting or the stop time of the entry, by clicking on the starting/stop time and filing out the Date-Time-Picker.
  4. Now, still on the screen with the "Sleep Details" you have multiple options to return to the main screen: a) use the on-screen "back" button, rendered by the app, b) use the hardware "back" button of the phone or c) close the app and open it again.

If you use 4.a) then the changes to the entry are saved. If you use 4.b) or 4.c) then the changes to the entry are not saved.

If I recall correctly, it was possible in earlier versions to use 4.b) to save the changes. Is this possible again with the patch of #255? Until a new version comes out, I'll use 4.a) as a workaround.

vmiklos commented 2 years ago

You can use https://github.com/vmiklos/plees-tracker/releases/download/v7.3.1-rc1/app-debug.apk right now to have the latest build from git which doesn't have this problem anymore.

I'll also cut 7.3.1 next week, unless something unexpected happens.

Other than this, sorry about the regression. Sadly writing automated tests for these problems on Android is much more tricky (at least for me) than with some random web service or cmdline tool, where I would be well up for some "no bugfixes without tests" policy. ;-)

sslater11 commented 2 years ago

Edit: Never mind, F-droid just told me there is an update which fixes this lmao.

Original message: Another solution for this is to change the time twice in a row.

After changing the date and time, you'll see it change in the app, click that time and you'll see the time selector displaying the original time, so set it again and that works for me :).

I've also posted my solution on issue #262