Let referee levels inherit from a lower level instead of relying on ordering alone
RefereeLevel.inherits_from chains levels together so a higher tier is automatically eligible for everything a linked lower tier covers, transitively, without hand-duplicating teams onto every level. Kept the ordering field (still drives display order) but eligibility everywhere (RefereeProfile.eligible_teams, events.services.referees, the team detail page's eligible-referees list) now reads through RefereeLevel.eligible_team_ids, which walks the inherits_from chain. clean() rejects a loop, including an indirect one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
<tr>
|
||||
<th>{% trans "Ordering" %}</th>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "Inherits from" %}</th>
|
||||
<th>{% trans "Qualifies for" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -26,12 +27,22 @@
|
||||
<tr>
|
||||
<td class="font-mono text-muted">{{ level.ordering }}</td>
|
||||
<td class="font-semibold text-ink">{{ level.name }}</td>
|
||||
<td>
|
||||
{% if level.inherits_from %}
|
||||
<span class="badge badge-info badge-sm">{{ level.inherits_from.name }}</span>
|
||||
{% else %}
|
||||
<span class="text-dim">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% for team in level.teams.all %}
|
||||
<span class="badge badge-outline badge-sm">{{ team.name }}</span>
|
||||
{% empty %}
|
||||
<span class="text-dim">—</span>
|
||||
{% if not level.inherits_from %}<span class="text-dim">—</span>{% endif %}
|
||||
{% endfor %}
|
||||
{% if level.inherits_from %}
|
||||
<div class="mt-1 text-xs text-muted">{% blocktrans with name=level.inherits_from.name %}+ everything “{{ name }}” covers{% endblocktrans %}</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{% if is_club_admin %}
|
||||
@@ -41,7 +52,7 @@
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center text-muted">{% trans "No referee levels yet." %}</td>
|
||||
<td colspan="5" class="text-center text-muted">{% trans "No referee levels yet." %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user