Commit 02741ce1 authored by Robert Czechowski's avatar Robert Czechowski

Add message field to contest, allow contest to have zero taskgroups in order to just show a message

parent c0a17ffd
Pipeline #799 passed with stages
in 22 minutes and 22 seconds
ALTER TABLE contest ADD COLUMN message TEXT;
ALTER TABLE contest ADD COLUMN message TEXT;
......@@ -28,6 +28,7 @@ struct ContestYaml {
requires_login: Option<bool>,
secret: Option<String>,
message: Option<String>,
min_grade: Option<i32>,
max_grade: Option<i32>,
......@@ -61,7 +62,8 @@ pub fn parse_yaml(content: &str, filename: &str, directory: &str) -> Option<Cont
config.max_grade,
config.position,
config.requires_login,
config.secret);
config.secret,
config.message);
// TODO: Timeparsing should fail more pleasantly (-> Panic, thus shows message)
for (positionalnumber, (name, info)) in config.tasks?.into_iter().enumerate() {
......
......@@ -299,6 +299,7 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
data.insert("parent".to_string(), to_json(&"base"));
data.insert("empty".to_string(), to_json(&"empty"));
data.insert("contest".to_string(), to_json(&ci));
data.insert("message".to_string(), to_json(&contest.message));
fill_oauth_data(oauth_infos, &mut data);
let constraints = check_contest_constraints(&session, &contest);
......@@ -310,6 +311,10 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
data.insert("has_duration".to_string(), to_json(&has_duration));
data.insert("can_start".to_string(), to_json(&can_start));
let has_tasks = contest.taskgroups.len() > 0;
data.insert("has_tasks".to_string(), to_json(&has_tasks));
data.insert("no_tasks".to_string(), to_json(&!has_tasks));
// Autostart if appropriate
// 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?
......@@ -878,13 +883,18 @@ pub fn show_profile<T: MedalConnection>(conn: &T, session_token: &str, user_id:
let now = time::get_time();
// TODO: Needs to be filtered
let participations: Vec<(i32, String, bool, bool)> = conn.get_all_participations_complete(session.id).into_iter().rev().map(|(participation, contest)| {
let passed_secs = now.sec - participation.start.sec;
let left_secs = i64::from(contest.duration) * 60 - passed_secs;
let is_time_left = contest.duration == 0 || left_secs >= 0;
let has_timelimit = contest.duration != 0;
(contest.id.unwrap(), contest.name, has_timelimit, is_time_left)
}).collect();
let participations: Vec<(i32, String, bool, bool)> =
conn.get_all_participations_complete(session.id)
.into_iter()
.rev()
.map(|(participation, contest)| {
let passed_secs = now.sec - participation.start.sec;
let left_secs = i64::from(contest.duration) * 60 - passed_secs;
let is_time_left = contest.duration == 0 || left_secs >= 0;
let has_timelimit = contest.duration != 0;
(contest.id.unwrap(), contest.name, has_timelimit, is_time_left)
})
.collect();
data.insert("participations".into(), to_json(&participations));
}
Some(user_id) => {
......
......@@ -124,7 +124,7 @@ impl MedalObject<Connection> for Contest {
let query = "UPDATE contest
SET location = $2,filename = $3, name = $4, duration = $5, public = $6, start_date = $7,
end_date = $8, min_grade = $9, max_grade = $10, positionalnumber = $11,
requires_login = $12, secret = $13
requires_login = $12, secret = $13, message = $14
WHERE id = $1";
conn.execute(query,
&[&id,
......@@ -139,14 +139,15 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
id
}
None => {
let query = "INSERT INTO contest (location, filename, name, duration, public, start_date, end_date,
min_grade, max_grade, positionalnumber, requires_login, secret)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)";
min_grade, max_grade, positionalnumber, requires_login, secret, message)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)";
conn.execute(query,
&[&self.location,
&self.filename,
......@@ -159,7 +160,8 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
conn.get_last_id().unwrap()
}
......@@ -917,7 +919,7 @@ impl MedalConnection for Connection {
fn get_contest_list(&self) -> Vec<Contest> {
let query = "SELECT id, location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
positionalnumber, requires_login, secret
positionalnumber, requires_login, secret, message
FROM contest
ORDER BY positionalnumber";
self.query_map_many(query, &[], |row| Contest { id: Some(row.get(0)),
......@@ -933,13 +935,14 @@ impl MedalConnection for Connection {
positionalnumber: row.get(10),
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
.unwrap()
}
fn get_contest_by_id(&self, contest_id: i32) -> Contest {
let query = "SELECT location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
requires_login, secret
requires_login, secret, message
FROM contest
WHERE id = $1";
self.query_map_one(query, &[&contest_id], |row| Contest { id: Some(contest_id),
......@@ -955,6 +958,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() })
.unwrap()
.unwrap() // TODO: Should return Option?
......@@ -963,8 +967,9 @@ impl MedalConnection for Connection {
fn get_contest_by_id_complete(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret, taskgroup.id, taskgroup.name, task.id,
task.location, task.stars
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name,
task.id, task.location, task.stars
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
JOIN task ON taskgroup.id = task.taskgroup
......@@ -986,36 +991,43 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() },
Task { id: Some(row.get(13)), taskgroup: row.get(11), location: row.get(14), stars: row.get(15) })
Task { id: Some(row.get(14)), taskgroup: row.get(12), location: row.get(15), stars: row.get(16) })
})
.unwrap();
let mut taskgroupcontest_iter = taskgroupcontest.into_iter();
let (mut contest, mut taskgroup, task) = taskgroupcontest_iter.next().unwrap();
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
if let Some((mut contest, mut taskgroup, task)) = taskgroupcontest_iter.next() {
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
}
taskgroup.tasks.push(t);
}
taskgroup.tasks.push(t);
contest.taskgroups.push(taskgroup);
contest
} else {
// If the contest has no tasks, we fall back to the function, that does not try to gather the task
// information
self.get_contest_by_id(contest_id)
}
contest.taskgroups.push(taskgroup);
contest
}
fn get_contest_by_id_partial(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest_secret, taskgroup.id, taskgroup.name
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
WHERE contest.id = $1
......@@ -1034,10 +1046,11 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() })
......@@ -1068,7 +1081,7 @@ impl MedalConnection for Connection {
fn get_all_participations_complete(&self, session_id: i32) -> Vec<(Participation, Contest)> {
let query = "SELECT participation.start_date, contest.id, location, filename, name, duration, public,
contest.start_date, end_date, min_grade, max_grade, requires_login, secret
contest.start_date, end_date, min_grade, max_grade, requires_login, secret, message
FROM participation
JOIN contest ON participation.contest = contest.id
WHERE participation.session = $1";
......@@ -1087,6 +1100,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
})
.unwrap()
......@@ -1128,7 +1142,7 @@ impl MedalConnection for Connection {
let query = "SELECT task.location, task.stars, taskgroup.id, taskgroup.name, taskgroup.active, contest.id,
contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret
contest.requires_login, contest.secret, contest.message
FROM contest
JOIN taskgroup ON taskgroup.contest = contest.id
JOIN task ON task.taskgroup = taskgroup.id
......@@ -1154,6 +1168,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(15),
secret: row.get(16),
message: row.get(17),
taskgroups: Vec::new() })
})
.unwrap()
......@@ -1300,7 +1315,7 @@ impl MedalConnection for Connection {
)
AND session = $2";
self.execute(query, &[&contest_id, &user_id]).unwrap();
let query = "DELETE FROM participation
WHERE contest = $1
AND session = $2";
......
......@@ -236,7 +236,7 @@ impl MedalObject<Connection> for Contest {
let query = "UPDATE contest
SET location = $2,filename = $3, name = $4, duration = $5, public = $6, start_date = $7,
end_date = $8, min_grade = $9, max_grade = $10, positionalnumber = $11,
requires_login = $12, secret = $13
requires_login = $12, secret = $13, message = $14
WHERE id = $1";
conn.execute(query,
&[&id,
......@@ -251,14 +251,15 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
id
}
None => {
let query = "INSERT INTO contest (location, filename, name, duration, public, start_date, end_date,
min_grade, max_grade, positionalnumber, requires_login, secret)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)";
min_grade, max_grade, positionalnumber, requires_login, secret, message)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)";
conn.execute(query,
&[&self.location,
&self.filename,
......@@ -271,7 +272,8 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
conn.get_last_id().unwrap()
}
......@@ -1029,7 +1031,7 @@ impl MedalConnection for Connection {
fn get_contest_list(&self) -> Vec<Contest> {
let query = "SELECT id, location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
positionalnumber, requires_login, secret
positionalnumber, requires_login, secret, message
FROM contest
ORDER BY positionalnumber";
self.query_map_many(query, &[], |row| Contest { id: Some(row.get(0)),
......@@ -1045,13 +1047,14 @@ impl MedalConnection for Connection {
positionalnumber: row.get(10),
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
.unwrap()
}
fn get_contest_by_id(&self, contest_id: i32) -> Contest {
let query = "SELECT location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
requires_login, secret
requires_login, secret, message
FROM contest
WHERE id = $1";
self.query_map_one(query, &[&contest_id], |row| Contest { id: Some(contest_id),
......@@ -1067,6 +1070,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() })
.unwrap()
.unwrap() // TODO: Should return Option?
......@@ -1075,8 +1079,9 @@ impl MedalConnection for Connection {
fn get_contest_by_id_complete(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret, taskgroup.id, taskgroup.name, task.id,
task.location, task.stars
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name,
task.id, task.location, task.stars
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
JOIN task ON taskgroup.id = task.taskgroup
......@@ -1098,36 +1103,43 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() },
Task { id: Some(row.get(13)), taskgroup: row.get(11), location: row.get(14), stars: row.get(15) })
Task { id: Some(row.get(14)), taskgroup: row.get(12), location: row.get(15), stars: row.get(16) })
})
.unwrap();
let mut taskgroupcontest_iter = taskgroupcontest.into_iter();
let (mut contest, mut taskgroup, task) = taskgroupcontest_iter.next().unwrap();
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
if let Some((mut contest, mut taskgroup, task)) = taskgroupcontest_iter.next() {
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
}
taskgroup.tasks.push(t);
}
taskgroup.tasks.push(t);
contest.taskgroups.push(taskgroup);
contest
} else {
// If the contest has no tasks, we fall back to the function, that does not try to gather the task
// information
self.get_contest_by_id(contest_id)
}
contest.taskgroups.push(taskgroup);
contest
}
fn get_contest_by_id_partial(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest_secret, taskgroup.id, taskgroup.name
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
WHERE contest.id = $1
......@@ -1146,10 +1158,11 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() })
......@@ -1180,7 +1193,7 @@ impl MedalConnection for Connection {
fn get_all_participations_complete(&self, session_id: i32) -> Vec<(Participation, Contest)> {
let query = "SELECT participation.start_date, contest.id, location, filename, name, duration, public,
contest.start_date, end_date, min_grade, max_grade, requires_login, secret
contest.start_date, end_date, min_grade, max_grade, requires_login, secret, message
FROM participation
JOIN contest ON participation.contest = contest.id
WHERE participation.session = $1";
......@@ -1199,6 +1212,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
})
.unwrap()
......@@ -1240,7 +1254,7 @@ impl MedalConnection for Connection {
let query = "SELECT task.location, task.stars, taskgroup.id, taskgroup.name, taskgroup.active, contest.id,
contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret
contest.requires_login, contest.secret, contest.message
FROM contest
JOIN taskgroup ON taskgroup.contest = contest.id
JOIN task ON task.taskgroup = taskgroup.id
......@@ -1266,6 +1280,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(15),
secret: row.get(16),
message: row.get(17),
taskgroups: Vec::new() })
})
.unwrap()
......@@ -1412,7 +1427,7 @@ impl MedalConnection for Connection {
)
AND session = $2";
self.execute(query, &[&contest_id, &user_id]).unwrap();
let query = "DELETE FROM participation
WHERE contest = $1
AND session = $2";
......
......@@ -236,7 +236,7 @@ impl MedalObject<Connection> for Contest {
let query = "UPDATE contest
SET location = ?2,filename = ?3, name = ?4, duration = ?5, public = ?6, start_date = ?7,
end_date = ?8, min_grade = ?9, max_grade = ?10, positionalnumber = ?11,
requires_login = ?12, secret = ?13
requires_login = ?12, secret = ?13, message = ?14
WHERE id = ?1";
conn.execute(query,
&[&id,
......@@ -251,14 +251,15 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
id
}
None => {
let query = "INSERT INTO contest (location, filename, name, duration, public, start_date, end_date,
min_grade, max_grade, positionalnumber, requires_login, secret)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)";
min_grade, max_grade, positionalnumber, requires_login, secret, message)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)";
conn.execute(query,
&[&self.location,
&self.filename,
......@@ -271,7 +272,8 @@ impl MedalObject<Connection> for Contest {
&self.max_grade,
&self.positionalnumber,
&self.requires_login,
&self.secret])
&self.secret,
&self.message])
.unwrap();
conn.get_last_id().unwrap()
}
......@@ -1029,7 +1031,7 @@ impl MedalConnection for Connection {
fn get_contest_list(&self) -> Vec<Contest> {
let query = "SELECT id, location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
positionalnumber, requires_login, secret
positionalnumber, requires_login, secret, message
FROM contest
ORDER BY positionalnumber";
self.query_map_many(query, &[], |row| Contest { id: Some(row.get(0)),
......@@ -1045,13 +1047,14 @@ impl MedalConnection for Connection {
positionalnumber: row.get(10),
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
.unwrap()
}
fn get_contest_by_id(&self, contest_id: i32) -> Contest {
let query = "SELECT location, filename, name, duration, public, start_date, end_date, min_grade, max_grade,
requires_login, secret
requires_login, secret, message
FROM contest
WHERE id = ?1";
self.query_map_one(query, &[&contest_id], |row| Contest { id: Some(contest_id),
......@@ -1067,6 +1070,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() })
.unwrap()
.unwrap() // TODO: Should return Option?
......@@ -1075,8 +1079,9 @@ impl MedalConnection for Connection {
fn get_contest_by_id_complete(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret, taskgroup.id, taskgroup.name, task.id,
task.location, task.stars
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name,
task.id, task.location, task.stars
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
JOIN task ON taskgroup.id = task.taskgroup
......@@ -1098,36 +1103,43 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() },
Task { id: Some(row.get(13)), taskgroup: row.get(11), location: row.get(14), stars: row.get(15) })
Task { id: Some(row.get(14)), taskgroup: row.get(12), location: row.get(15), stars: row.get(16) })
})
.unwrap();
let mut taskgroupcontest_iter = taskgroupcontest.into_iter();
let (mut contest, mut taskgroup, task) = taskgroupcontest_iter.next().unwrap();
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
if let Some((mut contest, mut taskgroup, task)) = taskgroupcontest_iter.next() {
taskgroup.tasks.push(task);
for tgc in taskgroupcontest_iter {
let (_, tg, t) = tgc;
if tg.id != taskgroup.id {
contest.taskgroups.push(taskgroup);
taskgroup = tg;
}
taskgroup.tasks.push(t);
}
taskgroup.tasks.push(t);
contest.taskgroups.push(taskgroup);
contest
} else {
// If the contest has no tasks, we fall back to the function, that does not try to gather the task
// information
self.get_contest_by_id(contest_id)
}
contest.taskgroups.push(taskgroup);
contest
}
fn get_contest_by_id_partial(&self, contest_id: i32) -> Contest {
let query = "SELECT contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest_secret, taskgroup.id, taskgroup.name
contest.requires_login, contest.secret, contest.message,
taskgroup.id, taskgroup.name
FROM contest
JOIN taskgroup ON contest.id = taskgroup.contest
WHERE contest.id = ?1
......@@ -1146,10 +1158,11 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(9),
secret: row.get(10),
message: row.get(11),
taskgroups: Vec::new() },
Taskgroup { id: Some(row.get(11)),
Taskgroup { id: Some(row.get(12)),
contest: contest_id,
name: row.get(12),
name: row.get(13),
active: true,
positionalnumber: None,
tasks: Vec::new() })
......@@ -1180,7 +1193,7 @@ impl MedalConnection for Connection {
fn get_all_participations_complete(&self, session_id: i32) -> Vec<(Participation, Contest)> {
let query = "SELECT participation.start_date, contest.id, location, filename, name, duration, public,
contest.start_date, end_date, min_grade, max_grade, requires_login, secret
contest.start_date, end_date, min_grade, max_grade, requires_login, secret, message
FROM participation
JOIN contest ON participation.contest = contest.id
WHERE participation.session = ?1";
......@@ -1199,6 +1212,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(11),
secret: row.get(12),
message: row.get(13),
taskgroups: Vec::new() })
})
.unwrap()
......@@ -1240,7 +1254,7 @@ impl MedalConnection for Connection {
let query = "SELECT task.location, task.stars, taskgroup.id, taskgroup.name, taskgroup.active, contest.id,
contest.location, contest.filename, contest.name, contest.duration, contest.public,
contest.start_date, contest.end_date, contest.min_grade, contest.max_grade,
contest.requires_login, contest.secret
contest.requires_login, contest.secret, contest.message
FROM contest
JOIN taskgroup ON taskgroup.contest = contest.id
JOIN task ON task.taskgroup = taskgroup.id
......@@ -1266,6 +1280,7 @@ impl MedalConnection for Connection {
positionalnumber: None,
requires_login: row.get(15),
secret: row.get(16),