diff --git a/mo/web/templates/user_index.html b/mo/web/templates/user_index.html index 021b555abc9e03b769bc752e9d72466a5b18495f..dae5f8681f382b2d5fcb6b36d2e37e87148becad 100644 --- a/mo/web/templates/user_index.html +++ b/mo/web/templates/user_index.html @@ -8,23 +8,39 @@ <table class="table"> <thead> <tr> - <th title='ročník MO'>Roč. - <th title='kategorie'>Kat. + <th>Kategorie <th>Kolo - <th>Oblast - <th>Stav - <th>Akce + <th>Stav účasti + <th>Stav soutěže + <th>Odkazy <tbody> {% for pion, contest, round in pions %} + {% set state = contest.ct_state() %} <tr> - <td>{{ round.year }} - <td>{{ round.category }} - <td>{{ round.name }} - <td>{{ contest.place.name }} + <td class="text-center" style="font-size: 1.2em"><b>{{ round.category }}</b> + <td>{{ round.name }} {{ contest.place.name_locative() if contest.place.level > 0 else '' }} + <td>{{ pion.state.friendly_name() }} <td>{{ contest.ct_long_state() }} - <td><div class="btn-group"> - <a class='btn btn-xs btn-primary' href='{{ url_for('user_contest', id=contest.contest_id) }}'>Detail kola</a> - </div> + <td> + {% if contest.ct_task_statement_available() %} + <a class='btn btn-xs btn-success' href='{{ url_for('user_task_statement', id=contest.contest_id) }}'>Zadání</a> + {% endif %} + {% if state != RoundState.preparing %} + <a class='btn btn-xs btn-primary' href='{{ url_for('user_contest', id=contest.contest_id) }}'> + {% if state == RoundState.running %} + Odevzdat řešení + {% elif state == RoundState.grading %} + Odevzdaná řešení + {% elif state == RoundState.closed %} + Prohlédnout opravy + {% else %} + Detail kola + {% endif %} + </a> + {% endif %} + {% if state == RoundState.closed %} + <a class="btn btn-xs btn-warning" href='{{ url_for('public_score', contest_id=contest.contest_id) }}'>Výsledky</a> + {% endif %} {% endfor %} </table> {% else %} diff --git a/mo/web/user.py b/mo/web/user.py index 65a958da2e7f61c8b2e30cafb85995fd6d9e6781..9d5c2df8165c2e152e59c72f43a97f44e15ce242 100644 --- a/mo/web/user.py +++ b/mo/web/user.py @@ -37,6 +37,7 @@ def load_pcrs() -> List[Tuple[db.Participation, db.Contest, db.Round]]: .join(db.Contest, db.Contest.master_contest_id == db.Participation.contest_id) .join(db.Round) .filter(db.Participation.user == g.user) + .filter(db.Round.year == mo.current_year) .options(joinedload(db.Contest.place)) .order_by(db.Round.year.desc(), db.Round.category, db.Round.seq, db.Round.part) .all())