Archived
1
0
Fork 0
forked from Anri/cal8tor

show days

This commit is contained in:
Mylloon 2022-08-18 01:16:51 +02:00
parent f6b6972ee5
commit 29117f7e28
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
use chrono::{Datelike, Duration, TimeZone, Utc};
use regex::Regex;
use scraper::{Html, Selector};
use tabled::{Table, Style};
pub mod models;
/// Fetch the timetable for a class
@ -322,5 +323,5 @@ fn get_semester(semester: Option<i8>, letter: Option<char>) -> i8 {
/// Display the timetable
pub fn display(timetable: (Vec<String>, (usize, Vec<models::Day>))) {
println!("{:#?}", timetable);
println!("{}", Table::new(timetable.1 .1).with(Style::modern()).to_string());
}

View file

@ -35,10 +35,11 @@ pub struct Course {
pub dtend: Option<chrono::DateTime<chrono::Utc>>,
}
#[derive(Debug)]
#[derive(Tabled, Debug)]
pub struct Day {
/// Day's name
pub name: String,
/// Ordered list of all the courses of the day
#[tabled(skip)]
pub courses: Vec<Option<Course>>,
}