This is the only way to easily work with the group; to assign it when we
create a build.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Group
- async def get_group(self):
- """
- Returns the build group this build is in
- """
- stmt = (
- sqlalchemy
- .select(
- BuildGroup,
- )
- .where(
- BuildGroup.deleted_at == None,
- BuildGroup.id == self.group_id,
- )
- )
-
- return await self.db.fetch_one(stmt)
+ group = sqlalchemy.orm.relationship(
+ "BuildGroup", foreign_keys=[group_id], lazy="selectin",
+ )
# Severity
{% block title %}{{ _("Build") }} - {{ build }}{% endblock %}
{% block body %}
- {# Fetch the group #}
- {% set group = build.get_group() %}
-
<section class="hero
{% if build.is_successful() %}
is-success
<h6 class="subtitle is-6">
<span class="tag is-warning">{{ _("Test Build") }}</span>
- <a href="/builds/{{ group.tested_build.uuid }}">
- {{ group.tested_build }}
+ <a href="/builds/{{ build.group.tested_build.uuid }}">
+ {{ build.group.tested_build }}
</a>
</h6>
{% else %}