Fix HTTP 500 when 'Use as today' date is after end date - #2
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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