]> git.ipfire.org Git - pbs.git/commitdiff
builds: Fix rendering bugs
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Jan 2025 13:06:57 +0000 (13:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Jan 2025 13:06:57 +0000 (13:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builds.py
src/templates/builds/show.html
src/web/builds.py

index f95a55dbdc7f14f52ef564cd90f4bb76bd67712d..e3f61b6954db859201bdf5656a8b8723b34da9ae 100644 (file)
@@ -828,25 +828,7 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                # Add it to the next repository
                await next_repo.add_build(build=self, user=user)
 
-       ## Bugs
-
-       @lazy_property
-       async def bug_ids(self):
-               rows = await self.db.query("""
-                       SELECT
-                               bug_id
-                       FROM
-                               build_bugs
-                       WHERE
-                               build_id = %s
-                       AND
-                               removed_at IS NULL
-                       ORDER BY
-                               bug_id
-                       """, self.id,
-               )
-
-               return set([row.bug_id for row in rows])
+       # Bugs
 
        async def _find_bug(self, bug_id):
                """
@@ -904,7 +886,22 @@ class Build(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                """
                        Fetch all bugs from Bugzilla
                """
-               return await self.backend.bugzilla.get_bugs(self.bug_ids)
+               stmt = (
+                       sqlalchemy
+                       .select(
+                               BuildBug.bug_id,
+                       )
+                       .where(
+                               BuildBug.build == self,
+                               BuildBug.removed_at == None,
+                       )
+               )
+
+               # Fetch all bug IDs
+               bug_ids = [b.bug_id async for b in self.db.select(stmt)]
+
+               # Fetch the bugs from Bugzilla
+               return await self.backend.bugzilla.get_bugs(bug_ids)
 
        # Monitoring Release
 
index ca98cf1568056cdfb02c41f55d09cd1ad5f2bf59..2c31b94c984663b2a7e274d6c5191812964e12fe 100644 (file)
@@ -76,6 +76,7 @@
                                                {% endif %}
 
                                                {# Bugs #}
+                                               {% set bugs = build.get_bugs() %}
                                                {% if bugs %}
                                                        <h5 class="title is-5">{{ _("Fixed Bugs") }}</h5>
 
index 87afc205c28478c3690a69e0d253c453c87a6f9a..cc97feea8fa8fd571e22fdd660974366ced6402b 100644 (file)
@@ -96,11 +96,8 @@ class ShowHandler(base.BaseHandler):
                if not build:
                        raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
 
-               # Fetch any fixed Bugs
-               bugs = [] # XXX await build.get_bugs()
-
-               await self.render("builds/show.html", build=build, pkg=build.pkg,
-                       distro=build.distro, bugs=bugs)
+               await self.render("builds/show.html", build=build,
+                       pkg=build.pkg, distro=build.distro)
 
 
 class ApproveHandler(base.BaseHandler):