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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
72ae40ef
Commit
72ae40ef
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Přidána stránka účastníka v soutěži
parent
986a6d64
No related branches found
No related tags found
1 merge request
!24
Stránka účastníka v soutěži
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/org_contest.py
+48
-2
48 additions, 2 deletions
mo/web/org_contest.py
mo/web/templates/org_contest_user.html
+58
-0
58 additions, 0 deletions
mo/web/templates/org_contest_user.html
with
106 additions
and
2 deletions
mo/web/org_contest.py
+
48
−
2
View file @
72ae40ef
...
...
@@ -246,7 +246,7 @@ def get_contest_site_rr(id: int, site_id: Optional[int], right_needed: Optional[
def
contest_breadcrumbs
(
round
:
Optional
[
db
.
Round
]
=
None
,
contest
:
Optional
[
db
.
Contest
]
=
None
,
site
:
Optional
[
db
.
Place
]
=
None
,
task
:
Optional
[
db
.
Task
]
=
None
,
action
:
Optional
[
str
]
=
None
user
:
Optional
[
db
.
User
]
=
None
,
action
:
Optional
[
str
]
=
None
)
->
str
:
elements
=
[(
url_for
(
'
org_rounds
'
),
'
Soutěže
'
)]
round_id
=
None
...
...
@@ -261,7 +261,6 @@ def contest_breadcrumbs(
if
site
:
site_id
=
site
.
place_id
elements
.
append
((
url_for
(
'
org_contest
'
,
id
=
ct_id
,
site_id
=
site_id
),
f
"
soutěžní místo
{
site
.
name
}
"
))
task_id
=
None
if
task
:
task_id
=
task
.
task_id
elements
.
append
((
...
...
@@ -269,6 +268,9 @@ def contest_breadcrumbs(
else
url_for
(
'
org_round_task_edit
'
,
id
=
round_id
,
task_id
=
task_id
),
f
"
{
task
.
code
}
{
task
.
name
}
"
))
if
user
:
user_id
=
user
.
user_id
elements
.
append
((
url_for
(
'
org_contest_user
'
,
contest_id
=
ct_id
,
user_id
=
user_id
),
user
.
full_name
()))
if
action
:
elements
.
append
((
''
,
action
))
...
...
@@ -1084,3 +1086,47 @@ def org_contest_task_upload(contest_id: int, task_id: int, site_id: Optional[int
return
generic_batch_upload
(
round
=
sc
.
round
,
contest
=
sc
.
contest
,
site
=
sc
.
site
,
task
=
sc
.
task
,
can_upload_solutions
=
sc
.
allow_upload_solutions
,
can_upload_feedback
=
sc
.
allow_upload_feedback
)
@app.route
(
'
/org/contest/c/<int:contest_id>/user/<int:user_id>
'
)
def
org_contest_user
(
contest_id
:
int
,
user_id
:
int
):
sc
=
get_solution_context
(
contest_id
,
user_id
,
None
,
None
)
sess
=
db
.
get_session
()
pant
=
sess
.
query
(
db
.
Participant
).
filter_by
(
user_id
=
user_id
,
year
=
sc
.
round
.
year
).
options
(
joinedload
(
db
.
Participant
.
school_place
)).
one_or_none
()
if
not
pant
:
return
werkzeug
.
exceptions
.
NotFound
()
task_sols
=
sess
.
query
(
db
.
Task
,
db
.
Solution
).
select_from
(
db
.
Task
).
outerjoin
(
db
.
Solution
,
and_
(
db
.
Solution
.
task_id
==
db
.
Task
.
task_id
,
db
.
Solution
.
user
==
sc
.
user
)
).
filter
(
db
.
Task
.
round
==
sc
.
round
).
options
(
joinedload
(
db
.
Solution
.
final_submit_obj
),
joinedload
(
db
.
Solution
.
final_feedback_obj
)
).
order_by
(
db
.
Task
.
code
).
all
()
# Count papers for each task and solution
tasks_subq
=
sess
.
query
(
db
.
Task
.
task_id
).
filter_by
(
round
=
sc
.
round
).
subquery
()
paper_counts
=
{}
for
task_id
,
type
,
count
in
(
db
.
get_session
().
query
(
db
.
Paper
.
for_task
,
db
.
Paper
.
type
,
func
.
count
(
db
.
Paper
.
type
))
.
filter
(
db
.
Paper
.
for_user
==
user_id
,
db
.
Paper
.
for_task
.
in_
(
tasks_subq
)
).
group_by
(
db
.
Paper
.
for_task
,
db
.
Paper
.
type
)
.
all
()
):
paper_counts
[(
task_id
,
type
.
name
)]
=
count
def
paper_link
(
paper
:
db
.
Paper
)
->
str
:
return
url_for
(
'
org_submit_paper
'
,
contest_id
=
sc
.
contest
.
contest_id
,
paper_id
=
paper
.
paper_id
,
filename
=
mo
.
web
.
util
.
task_paper_filename
(
paper
))
return
render_template
(
'
org_contest_user.html
'
,
sc
=
sc
,
pant
=
pant
,
task_sols
=
task_sols
,
paper_link
=
paper_link
,
paper_counts
=
paper_counts
,
)
This diff is collapsed.
Click to expand it.
mo/web/templates/org_contest_user.html
0 → 100644
+
58
−
0
View file @
72ae40ef
{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% set contest = sc.contest %}
{% set ct_id = contest.contest_id %}
{% set round = sc.round %}
{% set user = sc.user %}
{% block title %}{{ round.round_code() }}: účastník {{ user.full_name() }}{% endblock %}
{% block breadcrumbs %}
{{ contest_breadcrumbs(round=round, contest=contest, user=user) | safe }}
{% endblock %}
{% block body %}
<div
class=
"pull-right text-right form-frame"
>
<h4>
Rychlé odkazy
</h4>
Soutěžní kolo:
<div
class=
"btn-group"
>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_round_list', id=round.round_id) }}"
>
Účastníci
</a>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_score', round_id=round.round_id) }}"
>
Výsledky
</a>
</div>
<br>
Soutěžní oblast:
<div
class=
"btn-group"
>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_contest_solutions', id=ct_id) }}"
>
Tabulka řešení
</a>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_contest_list', id=ct_id) }}"
>
Účastníci
</a>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_score', contest_id=ct_id) }}"
>
Výsledky
</a>
</div>
</div>
<table
class=
data
>
<thead>
<tr><th
colspan=
'2'
>
Údaje o účastníkovi
</thead>
<tr><td>
Jméno:
<td>
{{ user.first_name }}
<tr><td>
Příjmení:
<td>
{{ user.last_name }}
<tr><td>
E-mail:
<td><a
href=
"mailto:{{ user.email }}"
>
{{ user.email }}
</a>
<tr><td>
Škola:
<td><a
href=
'{{ url_for('
org_place
',
id=
pant.school)
}}'
>
{{ pant.school_place.name }}
</a>
<tr><td>
Třída:
<td>
{{ pant.grade }}
<tr><td>
Rok narození:
<td>
{{ pant.birth_year }}
<tr><td>
Poznámka:
<td
style=
"white-space: pre;"
>
{{ user.note }}
<thead>
<tr><th
colspan=
'2'
>
Účast v kole
</thead>
<tr><td>
Soutěžní oblast:
<td><a
href=
'{{ url_for('
org_contest
',
id=
ct_id)
}}'
>
{{ contest.place.name }}
</a>
<tr><td>
Soutěžní místo:
<td><a
href=
'{{ url_for('
org_contest
',
id=
ct_id,
site_id=
sc.pion.place_id)
}}'
>
{{ sc.pion.place.name }}
</a>
<tr><td>
Stav účasti:
<td>
{{ sc.pion.state.friendly_name() }}
</table>
<a
class=
"btn btn-default"
href=
"{{ url_for('org_user', id=user.user_id) }}"
>
Detail uživatele
</a>
{% include "parts/org_submit_warning.html" %}
<h3>
Odevzdané úlohy
</h3>
{% with for_user=user, for_task=None, rows=task_sols, site_id=None %}
{% include "parts/org_solution_table.html" %}
{% endwith %}
{% endblock %}
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