store only the datetime objects
This commit is contained in:
parent
24be243dca
commit
2148166874
1 changed files with 7 additions and 13 deletions
20
src/info.rs
20
src/info.rs
|
@ -31,16 +31,13 @@ pub async fn info() {
|
||||||
|
|
||||||
let start_date = get_date(captures.name("d").unwrap().as_str());
|
let start_date = get_date(captures.name("d").unwrap().as_str());
|
||||||
|
|
||||||
let rep: i64 = captures.name("r").unwrap().as_str().parse().expect("NaN");
|
let rep: i64 = captures.name("r").unwrap().as_str().parse().unwrap();
|
||||||
// -1 car la première semaine est déjà compté
|
// -1 car la première semaine est déjà compté
|
||||||
let end_date = start_date + Duration::weeks(rep - 1);
|
let end_date = start_date + Duration::weeks(rep - 1);
|
||||||
|
|
||||||
data.insert(
|
data.insert(
|
||||||
i,
|
i,
|
||||||
format!(
|
vec![(start_date, end_date)],
|
||||||
"{} pendant {} semaines, donc arrêt le {}",
|
|
||||||
start_date, rep, end_date
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
e if e.starts_with("Reprise") => {
|
e if e.starts_with("Reprise") => {
|
||||||
|
@ -49,19 +46,16 @@ pub async fn info() {
|
||||||
|
|
||||||
let start_date = get_date(captures.name("d").unwrap().as_str());
|
let start_date = get_date(captures.name("d").unwrap().as_str());
|
||||||
|
|
||||||
let rep: i64 = captures.name("r").unwrap().as_str().parse().expect("NaN");
|
let rep: i64 = captures.name("r").unwrap().as_str().parse().unwrap();
|
||||||
// -1 car la première semaine est déjà compté
|
// -1 car la première semaine est déjà compté
|
||||||
let end_date = start_date + Duration::weeks(rep - 1);
|
let end_date = start_date + Duration::weeks(rep - 1);
|
||||||
|
|
||||||
|
let mut vec = data.get(&i).unwrap().to_owned();
|
||||||
|
vec.push((start_date, end_date));
|
||||||
|
|
||||||
data.insert(
|
data.insert(
|
||||||
i,
|
i,
|
||||||
format!(
|
vec,
|
||||||
"{}. Puis reprise {} pendant {} semaines, donc arrêt le {}",
|
|
||||||
data.get(&i).unwrap(),
|
|
||||||
start_date,
|
|
||||||
rep,
|
|
||||||
end_date
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
Reference in a new issue