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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
76d4dd1c
Commit
76d4dd1c
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Zrušena automatická registrace do testovací soutěže
Účastníci se tam brzy budou moci přihlásit sami.
parent
54193190
No related branches found
No related tags found
1 merge request
!86
Registrace
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
etc/config.py.example
+0
-4
0 additions, 4 deletions
etc/config.py.example
mo/web/user.py
+0
-33
0 additions, 33 deletions
mo/web/user.py
with
0 additions
and
37 deletions
etc/config.py.example
+
0
−
4
View file @
76d4dd1c
...
...
@@ -47,7 +47,3 @@ JOB_GC_PERIOD = 60
# Za jak dlouho expiruje dokončená dávka [min]
JOB_EXPIRATION = 5
# Automatické přihlašování účastníků do testovací soutěže
# (kolo aktuální_ročník-T-1, celostátní soutěž)
AUTO_REGISTER_TEST = False
This diff is collapsed.
Click to expand it.
mo/web/user.py
+
0
−
33
View file @
76d4dd1c
...
...
@@ -21,9 +21,6 @@ import mo.web.util
@app.route
(
'
/user/
'
)
def
user_index
():
pcrs
=
load_pcrs
()
if
getattr
(
config
,
'
AUTO_REGISTER_TEST
'
,
False
)
and
not
any
(
round
.
category
==
'
T
'
for
pion
,
contest
,
round
in
pcrs
):
if
register_to_test
():
pcrs
=
load_pcrs
()
return
render_template
(
'
user_index.html
'
,
...
...
@@ -43,36 +40,6 @@ def load_pcrs() -> List[Tuple[db.Participation, db.Contest, db.Round]]:
.
all
())
def
register_to_test
()
->
bool
:
sess
=
db
.
get_session
()
round
=
sess
.
query
(
db
.
Round
).
filter_by
(
year
=
mo
.
current_year
,
category
=
'
T
'
,
seq
=
1
,
part
=
0
).
one_or_none
()
if
not
round
:
app
.
logger
.
error
(
f
'
Nemohu najít kolo
{
mo
.
current_year
}
-T-1
'
)
return
False
if
round
.
level
!=
0
:
app
.
logger
.
error
(
f
'
Kolo
{
round
.
round_code_short
()
}
není na celostátní úrovni
'
)
return
False
contest
=
sess
.
query
(
db
.
Contest
).
filter_by
(
round
=
round
).
limit
(
1
).
one_or_none
()
if
not
contest
:
app
.
logger
.
error
(
f
'
Kolo
{
round
.
round_code_short
()
}
nemá soutěž
'
)
return
False
pion
=
db
.
Participation
(
user
=
g
.
user
,
contest
=
contest
,
place
=
contest
.
place
,
state
=
db
.
PartState
.
registered
)
sess
.
add
(
pion
)
sess
.
flush
()
mo
.
util
.
log
(
type
=
db
.
LogType
.
participant
,
what
=
g
.
user
.
user_id
,
details
=
{
'
action
'
:
'
add-to-contest
'
,
'
new
'
:
db
.
row2dict
(
pion
)},
)
sess
.
commit
()
app
.
logger
.
info
(
f
'
Účastník #
{
g
.
user
.
user_id
}
automaticky registrován do soutěže #
{
contest
.
contest_id
}
'
)
return
True
def
get_contest
(
id
:
int
)
->
db
.
Contest
:
contest
=
(
db
.
get_session
().
query
(
db
.
Contest
)
.
options
(
joinedload
(
db
.
Contest
.
place
),
...
...
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