From 8ce29102c9ae24f82226d7d3fe2b354d725f5941 Mon Sep 17 00:00:00 2001 From: George Madrid Date: Wed, 4 Jan 2023 15:47:05 -0500 Subject: [PATCH] Updating daily tasks --- src/bin/daily.rs | 40 ++++++++++++++++++++-------------------- src/bin/monthlies.rs | 6 +++++- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/bin/daily.rs b/src/bin/daily.rs index b126d7c..d6d00dc 100644 --- a/src/bin/daily.rs +++ b/src/bin/daily.rs @@ -40,9 +40,9 @@ mod data { pub days: Option>, } - fn weekdays_only() -> HashSet { - vec![Mon, Tue, Wed, Thu, Fri].into_iter().collect() - } + fn some_days(days: [Weekday; N]) -> Option> { Some(days.iter().copied().collect()) } + fn one_day(day: Weekday) -> Option> { some_days([day]) } + fn weekdays_only() -> Option> { some_days([Mon, Tue, Wed, Thu, Fri]) } lazy_static! { pub static ref TASKS: Vec> = { @@ -60,8 +60,12 @@ mod data { days: None, }, DailyTask { - name: "", - days: None, + name: "Workout", + days: some_days([Weekday::Mon, Weekday::Wed, Weekday::Fri]), + }, + DailyTask { + name: "Weekly review", + days: one_day(Weekday::Sun), }, DailyTask { name: "", @@ -96,48 +100,44 @@ mod data { days: None, }, DailyTask { - name: "", - days: None, - }, - DailyTask { - name: "Knit", + name: "Clean food", days: None, }, DailyTask { - name: "Magic", + name: "", days: None, }, DailyTask { - name: "", + name: "Journal", days: None, }, DailyTask { - name: "", + name: "Knit", days: None, }, DailyTask { - name: "", + name: "Magic", days: None, }, DailyTask { - name: "", + name: "Lone Wolf & Cub", days: None, }, DailyTask { - name: "", + name: "Read", days: None, }, DailyTask { name: "Bug sweep", - days: Some(weekdays_only()), + days: weekdays_only(), }, DailyTask { name: "Code reviews", - days: Some(weekdays_only()), + days: weekdays_only(), }, DailyTask { name: "Inbox Zero", - days: Some(weekdays_only()), + days: weekdays_only(), }, DailyTask { name: "Check calendar", @@ -281,7 +281,7 @@ fn render_dailies( page_rect: &WRect, ) -> weekly::Result { let grid_rect = - page_rect.inset_all_q1(0.5.inches(), 0.25.inches(), 0.25.inches(), 0.25.inches()); + page_rect.inset_all_q1(0.25.inches(), 0.25.inches(), 0.6.inches(), 0.25.inches()); let description = if let Some(end) = end_date { DailyDescription { bounds: grid_rect, diff --git a/src/bin/monthlies.rs b/src/bin/monthlies.rs index 96bf3f9..0362325 100644 --- a/src/bin/monthlies.rs +++ b/src/bin/monthlies.rs @@ -20,7 +20,11 @@ fn names_for_months(start_date: &NaiveDate, n: usize) -> Vec { let mut month = start_date.first_of_month(); let mut output = vec![]; for _ in 0..n { - output.push(month.format("%b %Y").to_string()); + if month.year() > start_date.year() { + output.push("".to_string()) + } else { + output.push(month.format("%b %Y").to_string()); + } month = month.next_month(); // next_month(&curr_month); } output