Skip to content
Snippets Groups Projects
Commit af9870bf authored by Martin Mareš's avatar Martin Mareš
Browse files

Overview: Už umíme i soutěžní místa na stejné úrovni

Hodí se, pokud se spojí více oblastí.
parent dfadd69f
No related branches found
No related tags found
1 merge request!122Různé drobné opravy
......@@ -66,19 +66,16 @@ def org_index():
.outerjoin(db.Contest, and_(db.Contest.round_id == db.Round.round_id, db.Contest.place_id == db.UserRole.place_id))
.all())
# Soutěžní místa, ke kterým máme roli dozoru nebo opravovatele
# Soutěžní místa, ke kterým máme nějakou roli
contest_place = aliased(db.Place)
place_rcu = (rcu_base
.filter(not_(db.Round.state.in_([db.RoundState.preparing, db.RoundState.closed]))) # for performance
.filter(db.Place.level == 4)
.filter(db.Place.level > db.Round.level)
.join(db.RegionDescendant, db.RegionDescendant.descendant == db.Place.place_id)
.join(contest_place, db.RegionDescendant.region == contest_place.place_id)
.filter(contest_place.level == db.Round.level)
.join(db.Contest, and_(db.Contest.round_id == db.Round.round_id, db.Contest.place_id == contest_place.place_id))
.filter(db.Place.level >= db.Round.level)
.join(db.Contest, db.Contest.round_id == db.Round.round_id)
.filter(sess.query(db.Participation)
.filter(and_(db.Participation.contest_id == db.Contest.contest_id,
db.Participation.place_id == db.Place.place_id))
db.Participation.place_id == db.Place.place_id,
db.Participation.place_id != db.Contest.place_id))
.exists())
.all())
......@@ -94,7 +91,7 @@ def org_index():
if ct is None and ur.place.level == r.level:
continue
o = overview[-1] if overview else None
if not (o and o.round == r and o.place == ur.place):
if not (o and o.round == r and o.place == ur.place and o.contest == ct):
o = OrgOverview(round=r, place=ur.place, contest=ct)
overview.append(o)
o.role_set.add(ur.role)
......
......@@ -42,7 +42,7 @@
{% if o.place == o.contest.place %}
<td>{{ o.place.name }}
{% else %}
<td><i>{{ o.place.name_locative() }}</i>
<td>{{ o.contest.place.name }} {{ o.place.name_locative() }}
{% endif %}
{% else %}
<td><i>{{ o.place.name_locative() }}</i>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment