Commit fb2b1c80 authored by Robert Czechowski's avatar Robert Czechowski

Hotfix: Don't show incorrect message of not being qualified if some constraint...

Hotfix: Don't show incorrect message of not being qualified if some constraint is not fullfilled in a challenge contest
parent 1be33300
Pipeline #614 canceled with stage
......@@ -256,7 +256,7 @@ fn check_contest_constraints(session: &SessionUser, contest: &Contest) -> Contes
let contest_running = !contest_not_begun && !contest_over;
let grade_matching = !grade_too_low && !grade_too_high;
let is_qualified = session.permanent_login;
let is_qualified = session.permanent_login || contest.requires_login == Some(true);
ContestStartConstraints { contest_not_begun,
contest_over,
......@@ -289,9 +289,9 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
let can_start = session.is_logged_in()
&& constraints.contest_running
&& constraints.grade_matching
&& (constraints.is_qualified || contest.requires_login == Some(true));
&& constraints.is_qualified;
let has_duration = contest.duration > 0;
data.insert("constraints".to_string(), to_json(&constraints));
data.insert("has_duration".to_string(), to_json(&has_duration));
data.insert("can_start".to_string(), to_json(&can_start));
......@@ -464,7 +464,7 @@ pub fn start_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_toke
if !(constraints.contest_running
&& constraints.grade_matching
&& (constraints.is_qualified || contest.requires_login == Some(true)))
&& constraints.is_qualified)
{
return Err(MedalError::AccessDenied);
}
......
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