Project

General

Profile

Actions

Defect #26387

closed

Error displaying time entries filtered by Activity

Added by Ulisse Bemer over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Time tracking
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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!

Actions

Also available in: Atom PDF