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
0d250fff
Commit
0d250fff
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Import: Nedovolíme vícenásobnou účast v tomtéž kole
parent
0281930b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/imports.py
+12
-3
12 additions, 3 deletions
mo/imports.py
with
12 additions
and
3 deletions
mo/imports.py
+
12
−
3
View file @
0d250fff
...
...
@@ -182,8 +182,12 @@ class Import:
place
=
contest
.
place
sess
=
db
.
get_session
()
pion
=
sess
.
query
(
db
.
Participation
).
get
((
user
.
user_id
,
contest
.
contest_id
))
if
not
pion
:
pions
=
(
sess
.
query
(
db
.
Participation
)
.
filter_by
(
user
=
user
)
.
filter
(
db
.
Participation
.
contest
.
has
(
db
.
Contest
.
round
==
contest
.
round
))
.
all
())
if
not
pions
:
pion
=
db
.
Participation
(
user
=
user
,
contest
=
contest
,
place_id
=
place
.
place_id
,
state
=
db
.
PartState
.
registered
)
sess
.
add
(
pion
)
mo
.
util
.
log
(
...
...
@@ -191,8 +195,13 @@ class Import:
what
=
user
.
user_id
,
details
=
{
'
action
'
:
'
add-to-contest
'
,
'
new
'
:
db
.
row2dict
(
pion
)},
)
elif
len
(
pions
)
==
1
:
pion
=
pions
[
0
]
if
pion
.
place
!=
place
:
return
self
.
error
(
'
Již se tohoto kola účastní v jiné oblasti
'
)
else
:
return
self
.
error
(
'
Již se tohoto kola účastní ve vice oblastech, což by nemělo být možné
'
)
# FIXME: Kontrolovat účast v tomtéž kole, ale jiném contestu
return
pion
def
import_contest_row
(
self
,
contest
:
Optional
[
db
.
Contest
],
r
:
ContestImportRow
):
...
...
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