forked from Anri/cal8tor
support for l3-a and l3-b
This commit is contained in:
parent
344b018936
commit
20fd40bbba
1 changed files with 20 additions and 17 deletions
|
@ -132,38 +132,41 @@ async fn get_webpage(
|
||||||
let panic_letter_message = "Unknown letter.";
|
let panic_letter_message = "Unknown letter.";
|
||||||
|
|
||||||
let base_url = "https://informatique.up8.edu/licence-iv/edt";
|
let base_url = "https://informatique.up8.edu/licence-iv/edt";
|
||||||
match year {
|
let allow_letters_1 = match semester {
|
||||||
1 => {
|
|
||||||
let allow_letters = match semester {
|
|
||||||
1 => ['a', 'b', 'c'],
|
1 => ['a', 'b', 'c'],
|
||||||
2 => ['x', 'y', 'z'],
|
2 => ['x', 'y', 'z'],
|
||||||
_ => panic!("{}", panic_semester_message),
|
_ => panic!("{}", panic_semester_message),
|
||||||
};
|
};
|
||||||
|
let allow_letters_2_3 = match semester {
|
||||||
|
1 => ['a', 'b'],
|
||||||
|
2 => ['x', 'y'],
|
||||||
|
_ => panic!("{}", panic_semester_message),
|
||||||
|
};
|
||||||
|
match year {
|
||||||
|
1 => {
|
||||||
let c = letter.expect(panic_letter_message).to_ascii_lowercase();
|
let c = letter.expect(panic_letter_message).to_ascii_lowercase();
|
||||||
if allow_letters.contains(&c) {
|
if allow_letters_1.contains(&c) {
|
||||||
format!("{}/l1-{}.html", base_url, c)
|
format!("{}/l1-{}.html", base_url, c)
|
||||||
} else {
|
} else {
|
||||||
panic!("{}", panic_letter_message)
|
panic!("{}", panic_letter_message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2 => {
|
2 => {
|
||||||
let allow_letters = match semester {
|
|
||||||
1 => ['a', 'b'],
|
|
||||||
2 => ['x', 'y'],
|
|
||||||
_ => panic!("{}", panic_semester_message),
|
|
||||||
};
|
|
||||||
let c = letter.expect(panic_letter_message).to_ascii_lowercase();
|
let c = letter.expect(panic_letter_message).to_ascii_lowercase();
|
||||||
if allow_letters.contains(&c) {
|
if allow_letters_2_3.contains(&c) {
|
||||||
format!("{}/l2-{}.html", base_url, c)
|
format!("{}/l2-{}.html", base_url, c)
|
||||||
} else {
|
} else {
|
||||||
panic!("{}", panic_letter_message)
|
panic!("{}", panic_letter_message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3 => match semester {
|
3 => {
|
||||||
1 => format!("{}/l3.html", base_url),
|
let c = letter.expect(panic_letter_message).to_ascii_lowercase();
|
||||||
2 => format!("{}/l3_2.html", base_url),
|
if allow_letters_2_3.contains(&c) {
|
||||||
_ => panic!("{}", panic_semester_message),
|
format!("{}/l3-{}.html", base_url, c)
|
||||||
},
|
} else {
|
||||||
|
panic!("{}", panic_letter_message)
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => panic!("Unknown year."),
|
_ => panic!("Unknown year."),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue