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
MO-P
Odevzdávací Systém MO
Commits
c63b03bb
Project 'mj/mo-submit' was moved to 'mo-p/osmo'. Please update any links and bookmarks that may still have the old path.
Commit
c63b03bb
authored
Jan 24, 2021
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Výjimky chceme vyvolávat, ne vracet jako výsledky
parent
b1832d2e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/org_contest.py
+1
-1
1 addition, 1 deletion
mo/web/org_contest.py
mo/web/user.py
+3
-3
3 additions, 3 deletions
mo/web/user.py
with
4 additions
and
4 deletions
mo/web/org_contest.py
+
1
−
1
View file @
c63b03bb
...
...
@@ -1078,7 +1078,7 @@ def org_contest_user(contest_id: int, user_id: int):
user_id
=
user_id
,
year
=
sc
.
round
.
year
).
options
(
joinedload
(
db
.
Participant
.
school_place
)).
one_or_none
()
if
not
pant
:
r
eturn
werkzeug
.
exceptions
.
NotFound
()
r
aise
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
)
...
...
This diff is collapsed.
Click to expand it.
mo/web/user.py
+
3
−
3
View file @
c63b03bb
...
...
@@ -173,14 +173,14 @@ def user_paper(id: int):
# XXX: Tímhle dáváme útočníkům orákulum na zjišťování validity IDček,
# ale to nevadí, protože IDčka stejně přidělujeme sekvenčně.
if
paper
is
None
:
r
eturn
werkzeug
.
exceptions
.
NotFound
()
r
aise
werkzeug
.
exceptions
.
NotFound
()
task
=
paper
.
task
round
=
task
.
round
if
paper
.
for_user
!=
g
.
user
.
user_id
:
logger
.
warn
(
f
'
Účastník #
{
g
.
user
.
user_id
}
chce cizí papír
'
)
r
eturn
werkzeug
.
exceptions
.
Forbidden
()
r
aise
werkzeug
.
exceptions
.
Forbidden
()
if
paper
.
type
==
db
.
PaperType
.
solution
:
allowed_states
=
[
db
.
RoundState
.
running
,
db
.
RoundState
.
grading
,
db
.
RoundState
.
closed
]
...
...
@@ -190,6 +190,6 @@ def user_paper(id: int):
assert
False
if
round
.
state
not
in
allowed_states
:
r
eturn
werkzeug
.
exceptions
.
Forbidden
()
r
aise
werkzeug
.
exceptions
.
Forbidden
()
return
mo
.
web
.
util
.
send_task_paper
(
paper
)
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
sign in
to comment