# by_user
# builder
# repository
+# points
#
EVENTS_VIEW = """
WITH events AS (
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
NULL AS user,
NULL AS by_user,
NULL AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
builds
WHERE
NULL AS user,
builds.deleted_by AS by_user,
NULL AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
builds
WHERE
NULL AS user,
builds.deprecated_by AS by_user,
NULL AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
builds
WHERE
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
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
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
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
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
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,
NULL AS user,
NULL AS by_user,
NULL AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
jobs
WHERE
NULL AS user,
NULL AS by_user,
jobs.builder_id AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
jobs
WHERE
NULL AS user,
NULL AS by_user,
jobs.builder_id AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
jobs
WHERE
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
NULL AS user,
NULL AS by_user,
jobs.builder_id AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
jobs
WHERE
NULL AS user,
NULL AS by_user,
NULL AS builder,
- NULL AS repository
+ NULL AS repository,
+ NULL AS points
FROM
jobs
JOIN
<p class="icon is-large has-text-danger">
<i class="fa-solid fa-2x fa-xmark"></i>
</p>
+ {% elif event.type == "build-points" and event.points > 0 %}
+ <p class="icon is-large has-text-success">
+ <i class="fa-solid fa-2x fa-thumbs-up"></i>
+ </p>
+ {% elif event.type == "build-points" and event.points < 0 %}
+ <p class="icon is-large has-text-danger">
+ <i class="fa-solid fa-2x fa-thumbs-down"></i>
+ </p>
{% else %}
<p class="icon is-large has-text-light">
<i class="fa-solid fa-2x fa-question"></i>
{{ _("%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" %}