From: Michael Tremer Date: Fri, 12 May 2023 21:10:21 +0000 (+0000) Subject: events: Add points to the log X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fb7cf34b4a59c9b556246b374529129d600cbed;p=pbs.git events: Add points to the log Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/events.py b/src/buildservice/events.py index d9149ac7..2e37543a 100644 --- a/src/buildservice/events.py +++ b/src/buildservice/events.py @@ -46,6 +46,7 @@ log = logging.getLogger("pbs.events") # by_user # builder # repository +# points # EVENTS_VIEW = """ WITH events AS ( @@ -61,7 +62,8 @@ EVENTS_VIEW = """ NULL::integer AS user, builds.owner_id AS by_user, NULL::integer AS builder, - NULL::integer AS repository + NULL::integer AS repository, + NULL::integer AS points FROM builds @@ -87,7 +89,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM builds WHERE @@ -107,7 +110,8 @@ EVENTS_VIEW = """ NULL AS user, builds.deleted_by AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM builds WHERE @@ -128,7 +132,8 @@ EVENTS_VIEW = """ NULL AS user, builds.deprecated_by AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM builds WHERE @@ -150,7 +155,8 @@ EVENTS_VIEW = """ NULL AS user, build_comments.user_id AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM build_comments WHERE @@ -170,7 +176,8 @@ EVENTS_VIEW = """ build_watchers.user_id AS user, NULL AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM build_watchers @@ -188,7 +195,8 @@ EVENTS_VIEW = """ build_watchers.user_id AS user, NULL AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM build_watchers WHERE @@ -208,7 +216,8 @@ EVENTS_VIEW = """ NULL AS user, repository_builds.added_by AS by_user, NULL AS builder, - repository_builds.repo_id AS repository + repository_builds.repo_id AS repository, + NULL AS points FROM repository_builds @@ -226,7 +235,8 @@ EVENTS_VIEW = """ NULL AS user, repository_builds.removed_by AS by_user, NULL AS builder, - repository_builds.repo_id AS repository + repository_builds.repo_id AS repository, + NULL AS points FROM repository_builds WHERE @@ -234,6 +244,26 @@ EVENTS_VIEW = """ UNION ALL + -- Build Scores + + SELECT + 'build-points' AS type, + build_points.created_at AS t, + 1 AS priority, + build_points.build_id AS build, + NULL AS by_build, + NULL AS build_comment, + NULL AS job, + NULL AS user, + build_points.user_id AS by_user, + NULL AS builder, + NULL AS repository, + build_points.points AS points + FROM + build_points + + UNION ALL + -- Jobs Creations SELECT 'job-created' AS type, @@ -246,7 +276,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs WHERE @@ -266,7 +297,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, jobs.builder_id AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs WHERE @@ -292,7 +324,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, jobs.builder_id AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs WHERE @@ -318,7 +351,8 @@ EVENTS_VIEW = """ NULL AS user, jobs.aborted_by AS by_user, jobs.builder_id AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs WHERE @@ -340,7 +374,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, jobs.builder_id AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs WHERE @@ -362,7 +397,8 @@ EVENTS_VIEW = """ NULL AS user, NULL AS by_user, NULL AS builder, - NULL AS repository + NULL AS repository, + NULL AS points FROM jobs JOIN diff --git a/src/templates/events/modules/system-message.html b/src/templates/events/modules/system-message.html index fcf2f217..cc72a7a5 100644 --- a/src/templates/events/modules/system-message.html +++ b/src/templates/events/modules/system-message.html @@ -25,6 +25,14 @@

+ {% elif event.type == "build-points" and event.points > 0 %} +

+ +

+ {% elif event.type == "build-points" and event.points < 0 %} +

+ +

{% else %}

@@ -52,6 +60,12 @@ {{ _("%s started watching this build") % event.user }} {% elif event.type == "build-watcher-removed" %} {{ _("%s stopped watching this build") % event.user }} + {% elif event.type == "build-points" %} + {% if event.points > 0 %} + {{ _("This build has gained one point", "This build has gained %(points)s points", event.points) % { "points" : event.points } }} + {% elif event.points < 0 %} + {{ _("This build has lost one point", "This build has lost %(points)s points", -event.points) % { "points" : -event.points } }} + {% end %} {% elif event.type == "job-created" %} {{ _("Job Created") }} {% elif event.type == "job-failed" %}