Commit 414ae08d authored by Robert Czechowski's avatar Robert Czechowski

Add new database field 'requires_contest' in contest

parent a7ec45a7
Pipeline #901 passed with stage
in 4 minutes and 6 seconds
ALTER TABLE contest ADD COLUMN requires_contest TEXT;
ALTER TABLE contest ADD COLUMN requires_contest TEXT;
......@@ -27,6 +27,7 @@ struct ContestYaml {
public_listing: Option<bool>,
requires_login: Option<bool>,
requires_contest: Option<String>,
secret: Option<String>,
message: Option<String>,
......@@ -62,6 +63,7 @@ pub fn parse_yaml(content: &str, filename: &str, directory: &str) -> Option<Cont
config.max_grade,
config.position,
config.requires_login,
config.requires_contest,
config.secret,
config.message);
// TODO: Timeparsing should fail more pleasantly (-> Panic, thus shows message)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -89,6 +89,7 @@ pub struct Contest {
pub max_grade: Option<i32>,
pub positionalnumber: Option<i32>,
pub requires_login: Option<bool>,
pub requires_contest: Option<String>,
pub secret: Option<String>,
pub taskgroups: Vec<Taskgroup>,
pub message: Option<String>,
......@@ -169,7 +170,7 @@ impl Contest {
#[allow(clippy::too_many_arguments)]
pub fn new(location: String, filename: String, name: String, duration: i32, public: bool,
start: Option<Timespec>, end: Option<Timespec>, min_grade: Option<i32>, max_grade: Option<i32>,
positionalnumber: Option<i32>, requires_login: Option<bool>, secret: Option<String>,
positionalnumber: Option<i32>, requires_login: Option<bool>, requires_contest: Option<String>, secret: Option<String>,
message: Option<String>)
-> Self
{
......@@ -185,6 +186,7 @@ impl Contest {
max_grade,
positionalnumber,
requires_login,
requires_contest,
secret,
message,
taskgroups: Vec::new() }
......
......@@ -297,6 +297,7 @@ mod tests {
None,
None,
None,
None,
None);
contest.save(&conn);
......@@ -313,6 +314,7 @@ mod tests {
None,
None,
None,
None,
None);
let mut taskgroup = Taskgroup::new("TaskgroupName".to_string(), None);
let task = Task::new("taskdir1".to_string(), 3); // ID: 1
......@@ -335,6 +337,7 @@ mod tests {
None,
None,
None,
None,
None);
let mut taskgroup = Taskgroup::new("TaskgroupName".to_string(), None);
let task = Task::new("taskdir1".to_string(), 3); // ID: 3
......@@ -357,6 +360,7 @@ mod tests {
None,
None,
None,
None,
None);
let mut taskgroup = Taskgroup::new("TaskgroupRenameName".to_string(), None);
let task = Task::new("taskdir1".to_string(), 3); // ID: 5
......
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