Defect #26387
closedError displaying time entries filtered by Activity
0%
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!