diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2022-10-01 07:51:23 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2022-10-01 07:51:23 +0100 |
commit | d09182da1c7c8c3b9cfd5f2bb9e86db54472c378 (patch) | |
tree | 435bb81614621e698d87320290b04b42bc92ee7d | |
parent | c5cc7d096f91308654180af8b5e4d88aa65250cf (diff) |
fixing bugs related to it being 1 Oct and also when no tasks present
-rwxr-xr-x | calendar/dayplan_revised.pl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/calendar/dayplan_revised.pl b/calendar/dayplan_revised.pl index 96eeca0..43e74a7 100755 --- a/calendar/dayplan_revised.pl +++ b/calendar/dayplan_revised.pl @@ -96,16 +96,24 @@ sub schoolblock { sub twblock { my ($y, $m, $d, $project, $type) = @_; $m = sprintf("%02d", $m); + $d = sprintf("%02d", $d); my $json = JSON->new->allow_nonref; my $tw= qx(task project:$project status:pending $type:$y-$m-$d export); - my $text = $json->decode( $tw ); my @output; push @output, "## Taskwarrior $type - $project:\n"; - foreach my $h (@{$text}) { - push @output, sprintf ("* %-16s: %s\n", ${$h}{'project'}, ${$h}{'description'}); + if ($tw eq "") { + push @output, "* No tasks"; + push @output, "\n"; + return @output; + } else + { + my $text = $json->decode( $tw ); + foreach my $h (@{$text}) { + push @output, sprintf ("* %-16s: %s\n", ${$h}{'project'}, ${$h}{'description'}); + } + push @output, "\n"; + return @output; } - push @output, "\n"; - return @output; } sub remindersblock { |