fix: project stats query for postgres (resolve #531)

This commit is contained in:
Ferdinand Mütsch
2023-10-04 20:03:31 +02:00
parent ce7b07ec75
commit 6946ad5e3c
4 changed files with 635 additions and 635 deletions

View File

@@ -233,11 +233,11 @@ func (r *HeartbeatRepository) GetUserProjectStats(user *models.User, from, to ti
"where user_id = ? and project != '' "+
"and time between ? and ? "+
"and language is not null and language != '' and project != '' "+
"group by project "+
"group by project, user_id "+
"order by last desc "+
"limit ? offset ? "+
") "+
"select distinct project, first, last, cnt as count, first_value(language) over (partition by project order by count(*) desc) as top_language "+
"select distinct project, min(first) as first, min(last) as last, min(cnt) as count, first_value(language) over (partition by project order by count(*) desc) as top_language "+
"from heartbeats "+
"inner join projects using (project, user_id) "+
"group by project, language "+