forked from Anri/cal8tor
show days
This commit is contained in:
parent
f6b6972ee5
commit
29117f7e28
2 changed files with 4 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
use chrono::{Datelike, Duration, TimeZone, Utc};
|
use chrono::{Datelike, Duration, TimeZone, Utc};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use scraper::{Html, Selector};
|
use scraper::{Html, Selector};
|
||||||
|
use tabled::{Table, Style};
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
/// Fetch the timetable for a class
|
/// Fetch the timetable for a class
|
||||||
|
@ -322,5 +323,5 @@ fn get_semester(semester: Option<i8>, letter: Option<char>) -> i8 {
|
||||||
|
|
||||||
/// Display the timetable
|
/// Display the timetable
|
||||||
pub fn display(timetable: (Vec<String>, (usize, Vec<models::Day>))) {
|
pub fn display(timetable: (Vec<String>, (usize, Vec<models::Day>))) {
|
||||||
println!("{:#?}", timetable);
|
println!("{}", Table::new(timetable.1 .1).with(Style::modern()).to_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,11 @@ pub struct Course {
|
||||||
pub dtend: Option<chrono::DateTime<chrono::Utc>>,
|
pub dtend: Option<chrono::DateTime<chrono::Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Tabled, Debug)]
|
||||||
pub struct Day {
|
pub struct Day {
|
||||||
/// Day's name
|
/// Day's name
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// Ordered list of all the courses of the day
|
/// Ordered list of all the courses of the day
|
||||||
|
#[tabled(skip)]
|
||||||
pub courses: Vec<Option<Course>>,
|
pub courses: Vec<Option<Course>>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue