summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-12-12 19:52:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-12-12 19:52:28 +0000
commite647e99b741ce0360ee479925009076f48d0d8a5 (patch)
treee4f9bf27a97cbae1842e7e3448c3055cfe5dad48 /app/models/query.rb
parent72980f41751a4d09c965733638572f799146e3e3 (diff)
downloadredmine-e647e99b741ce0360ee479925009076f48d0d8a5.tar.gz
redmine-e647e99b741ce0360ee479925009076f48d0d8a5.zip
Allow issues grouping by creation, update and closing date (#13803).
Implemented for PostgreSQL only for now. git-svn-id: http://svn.redmine.org/redmine/trunk@17724 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 1e8080b86..1aa09d2a2 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -71,11 +71,31 @@ class QueryColumn
object.send name
end
+ # Returns the group that object belongs to when grouping query results
+ def group_value(object)
+ value(object)
+ end
+
def css_classes
name
end
end
+class TimestampQueryColumn < QueryColumn
+
+ def groupable
+ if @groupable
+ Redmine::Database.timestamp_to_date(sortable, User.current.time_zone)
+ end
+ end
+
+ def group_value(object)
+ if time = value(object)
+ User.current.time_to_date(time)
+ end
+ end
+end
+
class QueryAssociationColumn < QueryColumn
def initialize(association, attribute, options={})