Defect #26387

Error displaying time entries filtered by Activity

Added by Ulisse Bemer 19 days ago. Updated 11 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Time tracking
Target version:3.4.2
Resolution:Fixed Affected version:3.4.1

Description

Hi,

first of all, thank you for developing this great project.

I noticed that when I'm going into the "Time tracking" section, if I add to the default Date filter also an Activity filter and then I apply it, a red band appears reading:
"An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."

By reading the log, I tracked down the cause: a JOIN was missing in the time_entry_query that is used to calculate the sum of the hours (the missing JOIN was to the "enumerations" table, that's why it raised an error whenever I added an activity filter.

I solved by changing one line in the app/models/time_entry_query.rb file, from this:

map_total(scope.sum(:hours)) {|t| t.to_f.round(2)}

to this:

map_total(scope.includes(:activity).sum(:hours)) {|t| t.to_f.round(2)}

If it's correct, would you please commit the change to the current tree so that it makes it in the next release?
Thank you!

Associated revisions

Revision 16808
Added by Jean-Philippe Lang 18 days ago

Error displaying time entries filtered by Activity (#26387).

History

#1 Updated by Toshi MARUYAMA 18 days ago

  • Status changed from New to Confirmed
  • Target version set to 3.4.2
  • Affected version changed from 3.4.0 to 3.4.1

#2 Updated by Jean-Philippe Lang 18 days ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Fixed in r16808. Thanks for reporting this.

#3 Updated by Jean-Philippe Lang 18 days ago

  • Subject changed from Error displaying time entries filtered by Activity - Likely solution inside to Error displaying time entries filtered by Activity

#4 Updated by Jean-Philippe Lang 11 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF