Skip to content

Fix sleeping hat shown before it is active

Closes #529 (closed)

What does this MR do?

Fixes the long-standing bug that users with a sleeping period starting in the future are already displayed as sleeping. This is done by saving those users with a sleep_status of 0, and putting users whose sleep period starts to sleep during nightly maintenance. The sleep mode form is adjusted to work correctly with these changes. Another bug waking users up one day to early was also fixed. The dev docs have been extended to explain how to run the nightly maintenance.

How confident are you it won't break things if deployed?

Quite confident, but there might be some wired edge cases with people currently having set a future sleep period.

Links to related MR:

I cherry-picked !1219 (closed) for this MR

How to test

  1. Log in and set your sleep interval to the future. Check you don't already have a sleeping hat.
  2. Change your pc time to the starting day of the interval and run the nightly maintenance script: ./scripts/docker-compose run --rm --no-deps app php -f run.php Maintenance daily
  3. Check you now have a sleeping hat.
  4. Increase time to the last day you set for sleeping, repeat maintenance script.
  5. Check you still have a sleeping hat.
  6. increse time another day and repeat script
  7. Hat should be gone now.

Another test you can to, to test the switch from current master:

  1. checkout master, set sleep interval in the future.
  2. Check that you have a sleeping hat.
  3. checkout to this branch
  4. run maintenance and increase time. Your hat will stay until the interval is over.

This means that in the transition time this bug will remain, but I don't think that's to bad.

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • set a "for:" label to indicate who will be affected by this change
  • added to the next milestone (see https://gitlab.com/foodsharing-dev/foodsharing/-/milestones, unless it has a "for:Dev" label)
  • added an entry to CHANGELOG.md
  • added a short text that can be used in the release notes
  • Once your MR has been merged, you are responsible to create a testing issue in the Beta Testing forum: https://foodsharing.de/?page=bezirk&bid=734&sub=forum. Please change the MRs label to "state:Beta testing".
    • Consider writing a detailed description in German.
    • Describe in a few sentences, what should be tested from a user perspective.
    • Also mention different settings (e.g. different browsers, roles, ...) how this change can be tested.
    • Be aware, that also non technical people should understand.

Release notes text in German

Falls man die Schlafmütze für ein Intervall in der Zukunft einstellt, wird diese nicht mehr zu früh angezeigt.

Edited by Anton Ballmaier

Merge request reports