@@ -48,7 +48,7 @@ def contributor_statistics
4848 } ,
4949 {
5050 key : 'currently_active' ,
51- name : t ( 'statistics.entries.users .currently_active' ) ,
51+ name : t ( 'statistics.entries.contributors .currently_active' ) ,
5252 data : Submission . from ( Submission . where ( created_at : 5 . minutes . ago ..) . distinct . select ( :contributor_id , :contributor_type ) ) . count ,
5353 url : statistics_graphs_path ,
5454 } ,
@@ -113,15 +113,12 @@ def rfc_statistics
113113 ]
114114 end
115115
116- # TODO: Need to consider and support programming groups
117116 def user_activity_live_data
118117 [
119118 {
120119 key : 'active_in_last_hour' ,
121- name : t ( 'statistics.entries.users.currently_active' ) ,
122- data : ExternalUser . joins ( :submissions )
123- . where ( submissions : { created_at : DateTime . now - 5 . minutes ..} )
124- . distinct ( 'external_users.id' ) . count ,
120+ name : t ( 'statistics.entries.contributors.currently_active' ) ,
121+ data : Submission . where ( created_at : DateTime . now - 5 . minutes ..) . distinct . select ( :contributor_id , :contributor_type ) . count ,
125122 } ,
126123 {
127124 key : 'submissions_per_minute' ,
@@ -215,15 +212,13 @@ def ranged_rfc_data(interval = 'year', from = DateTime.new(0), to = DateTime.now
215212 ]
216213 end
217214
218- # TODO: Need to consider and support programming groups
219215 def ranged_user_data ( interval = 'year' , from = DateTime . new ( 0 ) , to = DateTime . now )
220216 [
221217 {
222218 key : 'active' ,
223- name : t ( 'statistics.entries.users.active' ) ,
224- data : ExternalUser . joins ( :submissions )
225- . where ( submissions : { created_at : from ..to } )
226- . select ( ExternalUser . sanitize_sql ( [ 'date_trunc(?, submissions.created_at) AS "key", count(distinct external_users.id) AS "value"' , interval ] ) )
219+ name : t ( 'statistics.entries.contributors.active' ) ,
220+ data : Submission . where ( created_at : from ..to )
221+ . select ( Submission . sanitize_sql ( [ 'date_trunc(?, created_at) AS "key", count(distinct CONCAT(contributor_type, contributor_id)) AS "value"' , interval ] ) )
227222 . group ( 'key' ) . order ( 'key' ) ,
228223 } ,
229224 {
0 commit comments