Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
86f8fffc
Commit
86f8fffc
authored
May 06, 2020
by
Robert Czechowski
Committed by
Robert Czechowski
May 18, 2020
Browse files
Do not allow for submissions after contest time up
parent
d557d9de
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
86f8fffc
...
...
@@ -558,6 +558,26 @@ pub fn save_submission<T: MedalConnection>(conn: &T, task_id: i32, session_token
return
Err
(
MedalError
::
CsrfCheckFailed
);
}
let
(
_
,
_
,
c
)
=
conn
.get_task_by_id_complete
(
task_id
);
match
conn
.get_participation
(
&
session_token
,
c
.id
.expect
(
"Value from database"
))
{
None
=>
return
Err
(
MedalError
::
AccessDenied
),
Some
(
participation
)
=>
{
let
now
=
time
::
get_time
();
let
passed_secs
=
now
.sec
-
participation
.start.sec
;
if
passed_secs
<
0
{
// behandle inkonsistente Serverzeit
}
let
left_secs
=
i64
::
from
(
c
.duration
)
*
60
-
passed_secs
;
if
c
.duration
>
0
&&
left_secs
<
0
{
return
Err
(
MedalError
::
AccessDenied
)
// Contest over
// TODO: Nicer message!
}
}
}
let
submission
=
Submission
{
id
:
None
,
session_user
:
session
.id
,
task
:
task_id
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment