@@ -33,7 +33,7 @@ def working_time_query(tag = nil)
3333 max(score) as maximum_score,
3434 count(bar.id) as runs,
3535 sum(working_time_new) AS working_time,
36- max_updated_at as updated_at
36+ max( max_updated_at) as updated_at
3737 FROM
3838 (SELECT contributor_id,
3939 exercise_id,
@@ -50,7 +50,6 @@ def working_time_query(tag = nil)
5050 max(score) AS score,
5151 max(filtered_submissions.updated_at) FILTER (WHERE cause IN ('submit', 'assess', 'remoteSubmit', 'remoteAssess')) AS max_updated_at,
5252 filtered_submissions.id,
53- filtered_submissions.updated_at,
5453 (filtered_submissions.updated_at - lag(filtered_submissions.updated_at) over (PARTITION BY contributor_id, exercise_id
5554 ORDER BY filtered_submissions.updated_at)) AS working_time
5655 FROM filtered_submissions
@@ -65,8 +64,7 @@ def working_time_query(tag = nil)
6564 ) AS bar
6665 #{ tag . nil? ? '' : " JOIN exercise_tags et ON et.exercise_id = bar.exercise_id AND #{ ExternalUser . sanitize_sql ( [ 'et.tag_id = ?' , tag ] ) } " }
6766 GROUP BY contributor_id,
68- bar.exercise_id,
69- max_updated_at;
67+ bar.exercise_id;
7068 "
7169 end
7270
@@ -85,7 +83,6 @@ def statistics
8583 working_time_statistics = Submission . find_by_sql ( working_time_query ( tag &.id ) )
8684 ActiveRecord ::Associations ::Preloader . new ( records : working_time_statistics , associations : [ :exercise ] ) . call
8785 working_time_statistics . each do |tuple |
88- tuple [ 'working_time' ] = format_time_difference ( tuple [ 'working_time' ] )
8986 statistics [ tuple . exercise ] = tuple
9087 end
9188
0 commit comments