Commit 1c8637d3 authored by Robert Czechowski's avatar Robert Czechowski

Fix: Do not autostart contests that require login

parent c6723e0d
......@@ -293,7 +293,12 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
// TODO: Should participation start automatically for teacher? Even before the contest start?
// Should teachers have all time access or only the same limited amount of time?
// if opt_part.is_none() && (contest.duration == 0 || session.is_teacher) {
if opt_part.is_none() && contest.duration == 0 && constraints.contest_running && constraints.grade_matching {
if opt_part.is_none()
&& contest.duration == 0
&& constraints.contest_running
&& constraints.grade_matching
&& contest.requires_login != Some(true)
{
conn.new_participation(&session_token, contest_id).map_err(|_| MedalError::AccessDenied)?;
opt_part = Some(Participation { contest: contest_id, user: session.id, start: time::get_time() });
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment