Adds the date of the last activity to the list of available columns for Projects (#23954).

Patch by Frederico Camara (@fredsdc) and Marius BĂLTEANU (@marius.balteanu).

git-svn-id: https://svn.redmine.org/redmine/trunk@22811 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2024-05-03 13:14:18 +00:00
parent 6524dd3eaa
commit 8b57ffc3c7
10 changed files with 79 additions and 19 deletions

View File

@@ -64,9 +64,8 @@ module Redmine
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :scope option is deprecated. Please pass a scope on the #{self.name} as a proc."
end
if from && to
scope = scope.where("#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to)
end
scope = scope.where("#{provider_options[:timestamp]} >= ?", from) if from
scope = scope.where("#{provider_options[:timestamp]} <= ?", to) if to
if options[:author]
return [] if provider_options[:author_key].nil?
@@ -87,6 +86,10 @@ module Redmine
scope = scope.where(Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
end
if options[:last_by_project]
scope = scope.group("#{Project.table_name}.id").maximum(provider_options[:timestamp])
end
scope.to_a
end
end