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
89287a9d
Commit
89287a9d
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Tabulka všech řešení pro kolo i soutěžní místo
parent
2a3c4d95
No related branches found
No related tags found
2 merge requests
!13
Tabulky řešení
,
!9
WIP: Zárodek uživatelské části webu a submitování
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mo/web/org_contest.py
+24
-49
24 additions, 49 deletions
mo/web/org_contest.py
mo/web/templates/org_contest_solutions.html
+48
-1
48 additions, 1 deletion
mo/web/templates/org_contest_solutions.html
static/mo.css
+10
-0
10 additions, 0 deletions
static/mo.css
with
82 additions
and
50 deletions
mo/web/org_contest.py
+
24
−
49
View file @
89287a9d
...
...
@@ -413,76 +413,51 @@ def make_contestant_table(query: Query, add_checkbox: bool = False, add_contest_
@app.route
(
'
/org/contest/c/<int:id>/site/<int:site_id>/reseni
'
)
def
org_contest_solutions
(
id
:
int
,
site_id
:
Optional
[
int
]
=
None
):
contest
,
site
,
rr
=
get_contest_site_rr
(
id
,
site_id
,
Right
.
manage_contest
)
format
=
request
.
args
.
get
(
'
format
'
,
""
)
sess
=
db
.
get_session
()
pions_subq
=
sess
.
query
(
db
.
Participation
.
user_id
).
filter_by
(
contest
=
contest
)
if
site
:
pions_subq
=
pions_subq
.
filter_by
(
place
=
site
)
pions_subq
=
pions_subq
.
subquery
()
pions
=
(
sess
.
query
(
db
.
Participation
)
.
filter
_by
(
contest
=
contest
)
.
filter
(
db
.
Participation
.
user_id
.
in_
(
pions_subq
)
)
.
options
(
joinedload
(
db
.
Participation
.
user
))
.
all
())
tasks_subq
=
sess
.
query
(
db
.
Task
.
task_id
).
filter_by
(
round
=
contest
.
round
).
subquery
()
tasks
=
(
sess
.
query
(
db
.
Task
)
.
filter_by
(
round
=
contest
.
round
)
.
order_by
(
db
.
Task
.
code
)
.
all
())
pions_subq
=
(
sess
.
query
(
db
.
Participation
.
user_id
)
.
filter_by
(
contest
=
contest
)
.
subquery
())
sols
=
(
sess
.
query
(
db
.
Solution
)
.
filter
(
db
.
Solution
.
user_id
.
in_
(
pions_subq
))
.
options
(
joinedload
(
db
.
Solution
.
last_submit_obj
),
joinedload
(
db
.
Solution
.
last_feedback_obj
))
.
all
())
print
(
'
XXX pions:
'
,
pions
)
# FIXME
print
(
'
XXX tasks:
'
,
tasks
)
print
(
'
XXX sols:
'
,
sols
)
cols
=
[
Column
(
key
=
'
name
'
,
name
=
'
jmeno
'
,
title
=
'
Jméno
'
)
]
sols
=
sess
.
query
(
db
.
Solution
).
filter
(
db
.
Solution
.
user_id
.
in_
(
pions_subq
),
db
.
Solution
.
task_id
.
in_
(
tasks_subq
)
).
options
(
joinedload
(
db
.
Solution
.
last_submit_obj
),
joinedload
(
db
.
Solution
.
last_feedback_obj
)
).
all
()
task_sols
:
Dict
[
int
,
Dict
[
int
,
db
.
Solution
]]
=
{}
for
t
in
tasks
:
cols
.
append
(
Column
(
key
=
f
'
t-
{
t
.
task_id
}
'
,
name
=
t
.
code
))
task_sols
[
t
.
task_id
]
=
{}
for
s
in
sols
:
task_sols
[
s
.
task_id
][
s
.
user_id
]
=
s
rows
=
[]
for
pion
in
pions
:
user
=
pion
.
user
r
=
{
'
name
'
:
user
.
full_name
(),
}
for
t
in
tasks
:
s
=
task_sols
[
t
.
task_id
].
get
(
user
.
user_id
,
None
)
if
s
is
not
None
:
cell
=
'
*
'
else
:
cell
=
""
r
[
f
'
t-
{
t
.
task_id
}
'
]
=
cell
rows
.
append
(
r
)
print
(
'
XXX cols:
'
,
cols
)
# FIXME
print
(
'
XXX rows:
'
,
rows
)
table
=
Table
(
columns
=
cols
,
rows
=
rows
,
filename
=
'
reseni
'
,
)
def
paper_link
(
paper
:
db
.
Paper
)
->
str
:
return
url_for
(
'
org_submit_paper
'
,
contest_id
=
contest
.
contest_id
,
paper_id
=
paper
.
paper_id
,
site_id
=
site_id
,
filename
=
mo
.
web
.
util
.
task_paper_filename
(
paper
))
if
format
==
""
:
return
render_template
(
'
org_contest_solutions.html
'
,
contest
=
contest
,
site
=
site
,
table
=
table
,
pions
=
pions
,
tasks
=
tasks
,
tasks_sols
=
task_sols
,
paper_link
=
paper_link
,
)
else
:
return
table
.
send_as
(
format
)
@dataclass
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_contest_solutions.html
+
48
−
1
View file @
89287a9d
{% extends "base.html" %}
{% block body %}
{% set round = contest.round %}
{% set site_id = site.place_id if site else None %}
<h2>
<a
href=
'{{ url_for('
org_round
',
id=
contest.round_id)
}}'
>
Kolo {{ contest.round.round_code() }}
</a>
»
<a
href=
"{{ url_for('org_contest', id=contest.contest_id) }}"
>
{{ contest.place.name }}
</a>
...
...
@@ -8,6 +9,52 @@
» Tabulka řešení
</h2>
{{ table.to_html() }}
<p>
Všechna odevzdání od účastníka k úloze můžete vidět po kliknutí na ikonku 🔍.
Odkazem v záhlaví se lze dostat na detailní výpis odevzdání všech uživatelů pro
konkrétní úlohu.
</p>
<table
class=
"data full center"
>
<thead>
<tr>
<th
rowspan=
2
>
Účastník
{% for task in tasks %}
<th
colspan=
4
>
<a
href=
"{{ url_for('org_contest_task_submits', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
{{ task.code }}
</a>
{% endfor %}
<th
rowspan=
2
>
Body celkem
</tr>
<tr>
{% for task in tasks %}
<th
title=
"Řešení"
>
Řeš
<th
title=
"Oprava"
>
Opr
<th
title=
"Body"
>
B
<th
title=
"Detail"
>
🔍{% endfor %}
</tr>
</thead>
{% for pion in pions %}
<tr>
{% set u = pion.user %}
<th><a
href=
"{{ url_for('org_user', id=u.user_id) }}"
>
{{ u.full_name() }}
</a></th>
{% set sum_points = [] %}
{% for task in tasks %}
{% if u.user_id in tasks_sols[task.task_id] %}
{% set sol = tasks_sols[task.task_id][u.user_id] %}
{% set p = sol.last_submit_obj %}
{% set late = p.check_deadline(round) %}
<td
class=
"sol {% if late %}sol-late{% endif %}"
>
<a
href=
"{{ paper_link(p) }}"
title=
"{{ p.uploaded_at|timeformat }} - {{ p.pages|inflected('stránka', 'stránky', 'stránek') }}{% if late %} - {{ late }}{% endif %}"
>
🖺
</a>
<td
class=
"sol"
>
{% if sol.last_feedback_obj %}
{% set p = sol.last_feedback_obj %}
<a
href=
"{{ paper_link(p) }}"
title=
"{{ p.uploaded_at|timeformat }} - {{ p.pages|inflected('stránka', 'stránky', 'stránek') }}"
>
🖺
</a>
{% endif %}
<td
class=
"sol"
>
{% if sol.points %}
{{ sol.points }}
{% if sum_points.append(sol.points) %}{% endif %}
{% else %}–{% endif %}
<td
class=
"sol"
>
{% else %}
<td
colspan=
3
>
–
<td>
{% endif %}
<a
class=
"btn btn-xs btn-link"
title=
"Detail řešení"
href=
"{{ url_for('org_submit_list', contest_id=contest.contest_id, user_id=u.user_id, task_id=task.task_id, site_id=site_id) }}"
>
🔍
</a>
{% endfor %}
<th>
{{ sum_points|sum }}
</th>
</tr>
{% endfor %}
</table>
{% endblock %}
This diff is collapsed.
Click to expand it.
static/mo.css
+
10
−
0
View file @
89287a9d
...
...
@@ -68,6 +68,16 @@ table.data tr td, table.data tr th {
padding
:
0.1ex
0.5ex
;
}
table
.data
td
.sol
{
background-color
:
lightgreen
;
}
table
.data
td
.sol
a
{
color
:
black
;
}
table
.data
td
.sol-late
{
background-color
:
#ffaaaa
;
}
nav
#main-menu
{
display
:
flex
;
flex-wrap
:
wrap
;
...
...
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