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

Nastavování stavu kola počítá s delegací a propaguje změny

parent 64acbb53
No related branches found
No related tags found
1 merge request!49Stavy soutěže
...@@ -422,12 +422,25 @@ def org_round_edit(id: int): ...@@ -422,12 +422,25 @@ def org_round_edit(id: int):
if sess.is_modified(round): if sess.is_modified(round):
changes = db.get_object_changes(round) changes = db.get_object_changes(round)
app.logger.info(f"Round {id} modified, changes: {changes}") app.logger.info(f"Round #{id} modified, changes: {changes}")
mo.util.log( mo.util.log(
type=db.LogType.round, type=db.LogType.round,
what=id, what=id,
details={'action': 'edit', 'changes': changes}, details={'action': 'edit', 'changes': changes},
) )
if 'state' in changes and round.state != db.RoundState.delegate:
# Propagujeme změny stavu do všech soutěží
for contest in sess.query(db.Contest).filter_by(round=round).filter(db.Contest.state != round.state):
contest.state = round.state
ct_changes = db.get_object_changes(contest)
app.logger.info(f"Change propagated to contest #{contest.contest_id}: {ct_changes}")
mo.util.log(
type=db.LogType.contest,
what=contest.contest_id,
details={'action': 'propagate', 'changes': ct_changes},
)
sess.commit() sess.commit()
flash('Změny kola uloženy', 'success') flash('Změny kola uloženy', 'success')
else: else:
......
...@@ -65,18 +65,23 @@ ...@@ -65,18 +65,23 @@
<table class=data> <table class=data>
<thead> <thead>
<tr> <tr>
<th>Soutěžní oblasti <th>Soutěžní oblast
<th>Stav
<th>Počet účastníků <th>Počet účastníků
</tr> </tr>
</thead> </thead>
{% for (c, count) in contests_counts %} {% for (c, count) in contests_counts %}
<tr> <tr>
<td><a href='{{ url_for('org_contest', id=c.contest_id) }}'>{{ c.place.name }}</a> <td><a href='{{ url_for('org_contest', id=c.contest_id) }}'>{{ c.place.name }}</a>
{% with state=c.get_state() %}
<td class='rstate-{{state.name}}'>{{ state.friendly_name() }}
{% endwith %}
<td>{{ count }} <td>{{ count }}
{% endfor %} {% endfor %}
<tfoot> <tfoot>
<tr> <tr>
<th>Celkem <th>Celkem
<th>
<th>{{ contests_counts|sum(attribute=1) }} <th>{{ contests_counts|sum(attribute=1) }}
</tr> </tr>
</tfoot> </tfoot>
......
...@@ -206,6 +206,10 @@ nav#main-menu a.active { ...@@ -206,6 +206,10 @@ nav#main-menu a.active {
color: black; color: black;
} }
.rstate-delegate {
color: #888;
}
/* Solutions */ /* Solutions */
.sol-active { .sol-active {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment