Project

General

Profile

Defect #40728 » 40728-v2.patch

Go MAEDA, 2025-04-05 11:42

View differences:

app/models/time_entry_query.rb
164 164
  end
165 165

  
166 166
  def base_scope
167
    TimeEntry.visible.
168
      joins(:project, :user).
169
      includes(:activity).
170
      references(:activity).
171
      left_join_issue.
172
      where(statement)
167
    scope = TimeEntry.visible
168
                     .joins(:project, :user)
169
                     .includes(:activity)
170
                     .references(:activity)
171
                     .left_join_issue
172
                     .where(statement)
173

  
174
    if Redmine::Database.mysql? && ActiveRecord::Base.connection.supports_optimizer_hints?
175
      # Provides MySQL with a hint to use a better join order and avoid slow response times
176
      scope.optimizer_hints('JOIN_ORDER(time_entries,projects,users)')
177
    else
178
      scope
179
    end
173 180
  end
174 181

  
175 182
  def results_scope(options={})
(5-5/5)