Skip to content

Commit

Permalink
Updating daily tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
gmadrid committed Jan 4, 2023
1 parent a192a59 commit 8ce2910
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
40 changes: 20 additions & 20 deletions src/bin/daily.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ mod data {
pub days: Option<HashSet<Weekday>>,
}

fn weekdays_only() -> HashSet<Weekday> {
vec![Mon, Tue, Wed, Thu, Fri].into_iter().collect()
}
fn some_days<const N: usize>(days: [Weekday; N]) -> Option<HashSet<Weekday>> { Some(days.iter().copied().collect()) }
fn one_day(day: Weekday) -> Option<HashSet<Weekday>> { some_days([day]) }
fn weekdays_only() -> Option<HashSet<Weekday>> { some_days([Mon, Tue, Wed, Thu, Fri]) }

lazy_static! {
pub static ref TASKS: Vec<DailyTask<'static>> = {
Expand All @@ -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: "",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -281,7 +281,7 @@ fn render_dailies(
page_rect: &WRect,
) -> weekly::Result<Instructions> {
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,
Expand Down
6 changes: 5 additions & 1 deletion src/bin/monthlies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ fn names_for_months(start_date: &NaiveDate, n: usize) -> Vec<String> {
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
Expand Down

0 comments on commit 8ce2910

Please sign in to comment.