Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
ebf2817b
Commit
ebf2817b
authored
4 years ago
by
Jan Prachař
Browse files
Options
Downloads
Patches
Plain Diff
org_index: Tabulka Moje soutěže na úvodní stránce
parent
c47a0c4b
No related branches found
No related tags found
1 merge request
!65
Tabulka Moje soutěže
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/org.py
+29
-3
29 additions, 3 deletions
mo/web/org.py
mo/web/templates/org_index.html
+52
-0
52 additions, 0 deletions
mo/web/templates/org_index.html
with
81 additions
and
3 deletions
mo/web/org.py
+
29
−
3
View file @
ebf2817b
from
flask
import
render_template
,
redirect
,
url_for
,
request
,
flash
from
sqlalchemy.orm
import
aliased
from
flask
import
g
,
render_template
,
redirect
,
url_for
,
request
,
flash
from
sqlalchemy.orm
import
aliased
,
joinedload
import
mo.db
as
db
from
mo.rights
import
Right
,
roles_by_type
from
mo.web.jinja
import
user_url
import
mo.users
from
mo.web.table
import
Table
,
Row
,
Column
...
...
@@ -28,7 +29,32 @@ def org_index():
except
ValueError
:
flash
(
'
ID uživatele musí být číslo
'
,
'
danger
'
)
return
render_template
(
'
org_index.html
'
)
sess
=
db
.
get_session
()
roles
=
(
sess
.
query
(
db
.
UserRole
)
.
filter_by
(
user_id
=
g
.
user
.
user_id
)
.
options
(
joinedload
(
db
.
UserRole
.
place
))
.
all
())
contests
=
[]
for
role
in
roles
:
q
=
(
sess
.
query
(
db
.
Contest
,
db
.
UserRole
.
role
,
db
.
Round
)
.
select_from
(
db
.
Contest
)
.
filter_by
(
place_id
=
role
.
place_id
)
.
join
(
db
.
UserRole
,
db
.
UserRole
.
user_role_id
==
role
.
user_role_id
)
.
join
(
db
.
Round
))
if
role
.
year
:
q
=
q
.
filter
(
db
.
Round
.
year
==
role
.
year
)
if
role
.
category
:
q
=
q
.
filter
(
db
.
Round
.
category
==
role
.
category
)
if
role
.
seq
:
q
=
q
.
filter
(
db
.
Round
.
seq
==
role
.
seq
)
contests
+=
q
.
options
(
joinedload
(
db
.
Contest
.
place
)).
all
()
contests
.
sort
(
key
=
lambda
r
:
(
r
[
2
].
year
,
r
[
2
].
category
,
r
[
2
].
seq
,
r
[
2
].
part
))
return
render_template
(
'
org_index.html
'
,
contests
=
contests
,
Right
=
Right
,
role_names
=
db
.
role_type_names
,
gatekeeper
=
g
.
gatekeeper
)
school_export_columns
=
(
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_index.html
+
52
−
0
View file @
ebf2817b
...
...
@@ -2,6 +2,58 @@
{% block title %}Organizátorské rozhraní{% endblock %}
{% block body %}
{% if contests %}
<h3>
Moje soutěže
</h3>
<table
class=
"table table-bordered"
>
<thead><tr>
<th>
Kategorie
<th>
Kolo
<th>
Stav
<th>
Zadání
<th>
Moje role
<th>
Odkazy
</thead>
{% for c,role,r in contests %}
{% set rr = gatekeeper.rights_for_contest(c) %}
{% if c.state == RoundState.preparing %}
<tr
class=
"warning"
>
{% elif c.state == RoundState.running %}
<tr
class=
"success"
>
{% elif c.state == RoundState.grading %}
<tr
class=
"info"
>
{% else %}
<tr>
{% endif %}
<td
class=
"text-center"
style=
"font-size: 1.2em"
><b>
{{ r.category }}
</b>
<td>
{{ r.name }} {{ c.place.name_locativ() if c.place.level > 0 else '' }}
<td>
{{ c.state.friendly_name() }}
<td>
{% if rr.can_view_statement() %}
<a
href=
'{{ url_for('
org_task_statement
',
id=
r.round_id)
}}'
>
stáhnout
</a>
{% else %}
{{ rr.cannot_view_statement_reason() }}
{% endif %}
<td>
{{ role_names[role] }}
<td>
<a
class=
"btn btn-xs btn-primary"
href=
'{{ url_for('
org_contest
',
id=
c.contest_id)
}}'
>
Detail
</a>
<a
class=
"btn btn-xs btn-default"
href=
'{{ url_for('
org_contest_list
',
id=
c.contest_id)
}}'
>
Účastníci
</a>
{% if rr.can_view_submits() and c.state != RoundState.preparing %}
<a
class=
"btn btn-xs btn-success"
href=
'{{ url_for('
org_contest_solutions
',
id=
c.contest_id)
}}'
>
Odevzdaná řešení
</a>
{% endif %}
{% if (c.state == RoundState.grading and rr.can_view_submits()) or c.state == RoundState.closed %}
<a
class=
"btn btn-xs btn-warning"
href=
'{{ url_for('
org_score
',
contest_id=
c.contest_id)
}}'
>
Výsledky
</a>
{% endif %}
{% if rr.have_right(Right.manage_contest) and c.state != RoundState.closed %}
<a
class=
"btn btn-xs btn-primary"
href=
'{{ url_for('
org_contest_add_user
',
id=
c.contest_id)
}}'
>
+ Přidat účastníka
</a>
<a
class=
"btn btn-xs btn-default"
href=
'{{ url_for('
org_contest_import
',
id=
c.contest_id)
}}'
>
Import
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
{% endif %}
<h3>
Různé
</h3>
<ul>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment