diff --git a/frontend/coprs_frontend/coprs/logic/builds_logic.py b/frontend/coprs_frontend/coprs/logic/builds_logic.py index 64c1429e2..98e8980bb 100644 --- a/frontend/coprs_frontend/coprs/logic/builds_logic.py +++ b/frontend/coprs_frontend/coprs/logic/builds_logic.py @@ -129,6 +129,18 @@ def get_running_tasks_by_time(cls, start, end): return result + @classmethod + def get_users_by_time(cls, start, end): + """ Returns number of user that submitted at least one build in + the period. + """ + result = db.session.query(models.Build.user_id)\ + .join(models.BuildChroot)\ + .filter(models.BuildChroot.ended_on > start)\ + .filter(models.BuildChroot.started_on < end)\ + .group_by(models.Build.user_id).count() + return result + @classmethod def get_chroot_histogram(cls, start, end): chroots = [] @@ -150,6 +162,7 @@ def get_chroot_histogram(cls, start, end): l[0] = mock_chroot.name return chroots + @classmethod def get_pending_jobs_bucket(cls, start, end): query = text(""" diff --git a/frontend/coprs_frontend/coprs/templates/status/stats.html b/frontend/coprs_frontend/coprs/templates/status/stats.html index f4551689b..8ecc7e40c 100644 --- a/frontend/coprs_frontend/coprs/templates/status/stats.html +++ b/frontend/coprs_frontend/coprs/templates/status/stats.html @@ -20,6 +20,12 @@