From: Michael Tremer Date: Fri, 24 Jan 2025 13:06:57 +0000 (+0000) Subject: builds: Fix rendering bugs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2a665ddef6db7e4a50be6969e94b5e12854a452;p=pbs.git builds: Fix rendering bugs Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index f95a55db..e3f61b69 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -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 diff --git a/src/templates/builds/show.html b/src/templates/builds/show.html index ca98cf15..2c31b94c 100644 --- a/src/templates/builds/show.html +++ b/src/templates/builds/show.html @@ -76,6 +76,7 @@ {% endif %} {# Bugs #} + {% set bugs = build.get_bugs() %} {% if bugs %}
{{ _("Fixed Bugs") }}
diff --git a/src/web/builds.py b/src/web/builds.py index 87afc205..cc97feea 100644 --- a/src/web/builds.py +++ b/src/web/builds.py @@ -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):