Skip to content

Fix HTTP 500 when 'Use as today' date is after end date - #2

Merged
mboremski merged 1 commit into
developfrom
claude/fix-workload-issue-40-sQq72
Mar 21, 2026
Merged

Fix HTTP 500 when 'Use as today' date is after end date#2
mboremski merged 1 commit into
developfrom
claude/fix-workload-issue-40-sQq72

Conversation

@mboremski

Copy link
Copy Markdown
Owner

When the user sets a 'Use as today' (start_date) value beyond the last_day of the displayed time span, the UserWorkload model crashes with a NoMethodError because 'today' falls outside the time_span and hours_for_issue[today] returns nil.

Cap @today to @last_day in the controller before passing it to UserWorkload. Show a flash warning when the capping occurs so the user is informed.

Fixes xmera-circle#40

When the user sets a 'Use as today' (start_date) value beyond the
last_day of the displayed time span, the UserWorkload model crashes
with a NoMethodError because 'today' falls outside the time_span and
hours_for_issue[today] returns nil.

Cap @today to @last_day in the controller before passing it to
UserWorkload. Show a flash warning when the capping occurs so the
user is informed.

Fixes xmera-circle#40

https://claude.ai/code/session_01BSqVnAYvK1kCejeMnp4MqM
@mboremski
mboremski merged commit 8c321d1 into develop Mar 21, 2026
3 checks passed
@mboremski
mboremski deleted the claude/fix-workload-issue-40-sQq72 branch August 26, 2026 14:17
mboremski added a commit that referenced this pull request Aug 27, 2026
Fixes #2

The user list was always sorted by last name, regardless of the 'Users
display format' setting. On an installation showing 'Firstname Lastname'
the list therefore looked unsorted to the people reading it.

Sort by the name as Redmine renders it instead. The key lives in
RedmineWorkload::WlUserSorting because two call sites need it:

* WlUserSelection#allowed_to_display -- the filter's user list
* GroupWorkload#sorted_user_workload -- the rows of the workload table.
  The class name stays the first element of the key, so GroupUserDummy
  still comes before the real users.

GroupUserDummy aliases name to lastname and delegates id to its group, so
it works with the same key.

The test asserts the order flips between 'lastname_comma_firstname' and
'firstname_lastname'. It builds a fresh selection inside each
with_settings block, because User#name memoizes and would otherwise serve
the name from before the setting changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants