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
7b97ac14
Commit
7b97ac14
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Přidání allow_create_solutions do SolutionContext a drobný refaktoring
parent
3b3ff4a2
No related branches found
No related tags found
1 merge request
!30
Zakládání řešení zadáváním bodů
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mo/web/org_contest.py
+7
-4
7 additions, 4 deletions
mo/web/org_contest.py
mo/web/templates/org_contest_solutions.html
+2
-2
2 additions, 2 deletions
mo/web/templates/org_contest_solutions.html
mo/web/templates/org_contest_task.html
+1
-1
1 addition, 1 deletion
mo/web/templates/org_contest_task.html
with
10 additions
and
7 deletions
mo/web/org_contest.py
+
7
−
4
View file @
7b97ac14
...
@@ -353,6 +353,7 @@ def org_contest(id: int, site_id: Optional[int] = None):
...
@@ -353,6 +353,7 @@ def org_contest(id: int, site_id: Optional[int] = None):
can_manage
=
rr
.
have_right
(
Right
.
manage_contest
),
can_manage
=
rr
.
have_right
(
Right
.
manage_contest
),
can_upload
=
rr
.
can_upload_feedback
(
round
),
can_upload
=
rr
.
can_upload_feedback
(
round
),
can_edit_points
=
rr
.
can_edit_points
(
round
),
can_edit_points
=
rr
.
can_edit_points
(
round
),
can_create_solutions
=
rr
.
can_upload_feedback
(
round
)
or
rr
.
can_upload_solutions
(
round
),
can_view_statement
=
rr
.
can_view_statement
(
round
),
can_view_statement
=
rr
.
can_view_statement
(
round
),
tasks
=
tasks
,
places_counts
=
places_counts
,
tasks
=
tasks
,
places_counts
=
places_counts
,
)
)
...
@@ -556,6 +557,7 @@ class SolutionContext:
...
@@ -556,6 +557,7 @@ class SolutionContext:
allow_view
:
bool
allow_view
:
bool
allow_upload_solutions
:
bool
allow_upload_solutions
:
bool
allow_upload_feedback
:
bool
allow_upload_feedback
:
bool
allow_create_solutions
:
bool
allow_edit_points
:
bool
allow_edit_points
:
bool
...
@@ -608,6 +610,8 @@ def get_solution_context(contest_id: int, user_id: Optional[int], task_id: Optio
...
@@ -608,6 +610,8 @@ def get_solution_context(contest_id: int, user_id: Optional[int], task_id: Optio
if
not
allow_view
:
if
not
allow_view
:
raise
werkzeug
.
exceptions
.
Forbidden
()
raise
werkzeug
.
exceptions
.
Forbidden
()
allow_upload_solutions
=
rr
.
can_upload_solutions
(
round
)
allow_upload_feedback
=
rr
.
can_upload_feedback
(
round
)
return
SolutionContext
(
return
SolutionContext
(
contest
=
contest
,
contest
=
contest
,
round
=
round
,
round
=
round
,
...
@@ -617,8 +621,9 @@ def get_solution_context(contest_id: int, user_id: Optional[int], task_id: Optio
...
@@ -617,8 +621,9 @@ def get_solution_context(contest_id: int, user_id: Optional[int], task_id: Optio
site
=
site
,
site
=
site
,
# XXX: Potřebujeme tohle všechno? Nechceme spíš vracet rr a nechat každého, ať na něm volá metody?
# XXX: Potřebujeme tohle všechno? Nechceme spíš vracet rr a nechat každého, ať na něm volá metody?
allow_view
=
allow_view
,
allow_view
=
allow_view
,
allow_upload_solutions
=
rr
.
can_upload_solutions
(
round
),
allow_upload_solutions
=
allow_upload_solutions
,
allow_upload_feedback
=
rr
.
can_upload_feedback
(
round
),
allow_upload_feedback
=
allow_upload_feedback
,
allow_create_solutions
=
allow_upload_solutions
or
allow_upload_feedback
,
allow_edit_points
=
rr
.
can_edit_points
(
round
),
allow_edit_points
=
rr
.
can_edit_points
(
round
),
)
)
...
@@ -1024,8 +1029,6 @@ def org_contest_solutions(id: int, site_id: Optional[int] = None):
...
@@ -1024,8 +1029,6 @@ def org_contest_solutions(id: int, site_id: Optional[int] = None):
'
org_contest_solutions.html
'
,
'
org_contest_solutions.html
'
,
contest
=
sc
.
contest
,
site
=
sc
.
site
,
sc
=
sc
,
contest
=
sc
.
contest
,
site
=
sc
.
site
,
sc
=
sc
,
pions
=
pions
,
tasks
=
tasks
,
tasks_sols
=
task_sols
,
paper_counts
=
paper_counts
,
pions
=
pions
,
tasks
=
tasks
,
tasks_sols
=
task_sols
,
paper_counts
=
paper_counts
,
can_upload
=
sc
.
allow_upload_feedback
,
can_edit_points
=
sc
.
allow_edit_points
,
paper_link
=
lambda
u
,
p
:
mo
.
web
.
util
.
org_paper_link
(
sc
.
contest
,
sc
.
site
,
u
,
p
),
paper_link
=
lambda
u
,
p
:
mo
.
web
.
util
.
org_paper_link
(
sc
.
contest
,
sc
.
site
,
u
,
p
),
)
)
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_contest_solutions.html
+
2
−
2
View file @
7b97ac14
...
@@ -36,7 +36,7 @@ konkrétní úlohu. Symbol <span class="icon">🗐</span> značí, že existuje
...
@@ -36,7 +36,7 @@ konkrétní úlohu. Symbol <span class="icon">🗐</span> značí, že existuje
<th
rowspan=
2
>
Stav účasti
</th>
<th
rowspan=
2
>
Stav účasti
</th>
{% for task in tasks %}
<th
colspan=
4
>
{% for task in tasks %}
<th
colspan=
4
>
<a
href=
"{{ url_for('org_contest_task', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
{{ task.code }}
</a>
<a
href=
"{{ url_for('org_contest_task', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
{{ task.code }}
</a>
{% if
can
_edit_points %}
{% if
sc.allow
_edit_points %}
<a
title=
"Editovat body"
href=
"{{ url_for('org_contest_task_points', contest_id=contest.contest_id, task_id=task.task_id) }}"
class=
"icon pull-right"
>
✎
</a>
<a
title=
"Editovat body"
href=
"{{ url_for('org_contest_task_points', contest_id=contest.contest_id, task_id=task.task_id) }}"
class=
"icon pull-right"
>
✎
</a>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
...
@@ -100,7 +100,7 @@ konkrétní úlohu. Symbol <span class="icon">🗐</span> značí, že existuje
...
@@ -100,7 +100,7 @@ konkrétní úlohu. Symbol <span class="icon">🗐</span> značí, že existuje
{% for task in tasks %}
{% for task in tasks %}
<td
colspan=
4
><div
class=
'btn-group'
>
<td
colspan=
4
><div
class=
'btn-group'
>
<a
class=
'btn btn-xs btn-primary'
href=
"{{ url_for('org_contest_task_download', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
Stáhnout
</a>
<a
class=
'btn btn-xs btn-primary'
href=
"{{ url_for('org_contest_task_download', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
Stáhnout
</a>
{% if
can_upload
%}
{% if
sc.allow_upload_feedback
%}
<a
class=
'btn btn-xs btn-primary'
href=
"{{ url_for('org_contest_task_upload', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
Nahrát
</a>
<a
class=
'btn btn-xs btn-primary'
href=
"{{ url_for('org_contest_task_upload', contest_id=contest.contest_id, site_id=site_id, task_id=task.task_id) }}"
>
Nahrát
</a>
{% endif %}
{% endif %}
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_contest_task.html
+
1
−
1
View file @
7b97ac14
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
{% else %}
{% else %}
<div
class=
'btn-group'
>
<div
class=
'btn-group'
>
<a
class=
'btn btn-primary'
href=
"{{ url_for('org_contest_task_download', contest_id=ct_id, site_id=site_id, task_id=task.task_id) }}"
>
Stáhnout řešení
</a>
<a
class=
'btn btn-primary'
href=
"{{ url_for('org_contest_task_download', contest_id=ct_id, site_id=site_id, task_id=task.task_id) }}"
>
Stáhnout řešení
</a>
{% if
can_upload
%}
{% if
sc.allow_upload_feedback
%}
<a
class=
'btn btn-primary'
href=
"{{ url_for('org_contest_task_upload', contest_id=ct_id, site_id=site_id, task_id=task.task_id) }}"
>
Nahrát opravená řešení
</a>
<a
class=
'btn btn-primary'
href=
"{{ url_for('org_contest_task_upload', contest_id=ct_id, site_id=site_id, task_id=task.task_id) }}"
>
Nahrát opravená řešení
</a>
{% endif %}
{% endif %}
{% if not site and sc.allow_edit_points %}
{% if not site and sc.allow_edit_points %}
...
...
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