Defect #33341

Time entry user is shown twice in the User drop-down when editing spent time

Added by Thomas Löber 4 months ago. Updated 4 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Time tracking
Target version:4.1.2
Resolution:Fixed Affected version:4.1.1

Description

Hi,

When editing Spent Time the current time entry user is shown twice in the User drop-down.

This is because the condition to add the current time entry user to the collection is wrong in TimelogHelper#user_collection_for_select_options.

It is:

collection << time_entry.user unless time_entry.user.nil? && !collection.include?(time_entry.user)

But it should be:

collection << time_entry.user if time_entry.user && !collection.include?(time_entry.user)

Best regards,
Thomas

timelog_helper.diff Magnifier (686 Bytes) Thomas Löber, 2020-04-22 16:04

33341-screenshot.png (109 KB) Go MAEDA, 2020-04-22 16:12

0001-Fix-time-entry-user-is-shown-twice-in-the-User-drop-.patch Magnifier (1.51 KB) Marius BALTEANU, 2020-04-26 18:51


Related issues

Related to Redmine - Defect #32973: Editing a time entry for a locked user changes the user t... Closed

Associated revisions

Revision 19727
Added by Go MAEDA 4 months ago

Fix time entry user is shown twice in the User drop-down (#33341).

Patch by Thomas Löber and Marius BALTEANU.

Revision 19728
Added by Go MAEDA 4 months ago

Merged r19727 from trunk to 4.1-stable (#33341).

History

#1 Updated by Go MAEDA 4 months ago

  • File 33341-screenshot.png added
  • Status changed from New to Confirmed
  • Affected version set to 4.1.0

#2 Updated by Go MAEDA 4 months ago

  • Affected version changed from 4.1.0 to 4.1.1

#3 Updated by Go MAEDA 4 months ago

  • Related to Defect #32973: Editing a time entry for a locked user changes the user to the current user added

#4 Updated by Go MAEDA 4 months ago

  • Target version set to 4.1.2

#5 Updated by Marius BALTEANU 4 months ago

The fix looks good to me. The attached patch contains the fix and an assertion.

Tests pass: https://gitlab.com/redmine-org/redmine/pipelines/139995890

#6 Updated by Go MAEDA 4 months ago

  • Subject changed from When editing Spent Time the current time entry user is shown twice in the User drop-down to Time entry user is shown twice in the User drop-down when editing spent time
  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you.

Also available in: Atom PDF