engelsystem icon indicating copy to clipboard operation
engelsystem copied to clipboard

add ability to mark work log as nightshift

Open olebittner opened this issue 11 months ago • 2 comments

This PR adds the ability to mark work logs as night shifts to apply the night bonus multiplier, implementing #710.

  • added db column "night_shift" to worklogs table
  • added night shift checkbox to edit-worklog view
  • nightshift-work logs multiplied with nighshift muliplier in User_model
  • nightshift info text (moon) added to User_view

This is my first PR for the engelsystem and I'm not fully familiar with the codebase. Please let me know if I can improve anything. Unit tests and the pre-commit hook ran successfully.

Please find screenshots of the adjusted views below:

User_view

grafik

edit-worklog

grafik

olebittner avatar Jan 16 '25 22:01 olebittner

Thank you Xu for the review. I changed the "worklog sum" function from a function that returns the calculated value to one that returns the sql query (similar to the shift sum function). That way I can also use it in the admin_active page. But it feels like a decrease in code quality to me, if you have a better/cleaner idea please let me know.

I assume we wait with merging until #1481 is done? I can rebase then, doesn't seem to complicated to move my changes to the Goodie helper aswell.

olebittner avatar Jan 20 '25 22:01 olebittner

Hi, sorry that it took so long. The PR #1481 is merged now.

xuwhite avatar Apr 09 '25 13:04 xuwhite

Hi, do you have any update on this?

xuwhite avatar Sep 22 '25 18:09 xuwhite

Hi, do you have any update on this?

Hi and yes. I already rebased it and did the necessary adjustments, but I didn't have time to test it thoroughly. I hope I will get to it end of next week.

olebittner avatar Sep 24 '25 22:09 olebittner

Nice, I'm looking forward to see the changes.

xuwhite avatar Sep 25 '25 21:09 xuwhite

Here you go 🤗

I moved the logic to the Goodie helper and also updated the worklogScoreQuery to return an Expression like the shiftScoreQuery. ~As a result of that, the GoodieTest::testUserScore testcase needed to be adjusted and now barely tests anything, but I didn't want to remove your testcases and adjusted the assertion to expect 0. Please check if this is ok.~ nvm, I just needed to adjust the setup.

I also wasn't sure if you want me to rename the db migration to a current date, if yes, please say so.

olebittner avatar Sep 29 '25 21:09 olebittner

Thank you very much its fine as is.

xuwhite avatar Oct 01 '25 14:10 xuwhite