diff options
author | cos <cos> | 2012-05-25 08:17:09 +0200 |
---|---|---|
committer | cos <cos> | 2012-12-17 21:12:07 +0100 |
commit | ce997e6136f96c52dd869cedce63ca412eaa2367 (patch) | |
tree | 65b9903f255260f6ce4923100cee9288b31a8af6 | |
parent | 299c3b127fb36820244fde8a1008d0685d26898e (diff) | |
download | mat-ce997e6136f96c52dd869cedce63ca412eaa2367.zip |
Make showplan show four weeks separated with blank lines.
-rwxr-xr-x | mat | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -224,6 +224,7 @@ sub get_plan_state { sub cmd_showplan { my ( $date ) = @_; my $dt; + my $weekend_padding = ""; if($date) { return -1 unless $date =~ "^[0-9]{4}-[0-9]{2}-[0-9]{2}\$"; @@ -233,17 +234,25 @@ sub cmd_showplan { # FIXME now() is not start of day, set hour, minute and such to 0 } - for (my $i = 0; $i < 7; $i++) { + for (my $i = 0; $i < 28; $i++) { my $sql = "SELECT recipe_id, mealtype FROM plan WHERE date='".$dt->ymd(). "';"; my @ids = $db->selectrow_array($sql); + print $weekend_padding; if ($ids[0]) { printf "%9s %-10s %3s|%s %s, %s\n", $dt->ymd(), $ids[1], $ids[0], substr(get_plan_state($dt->ymd()), 0, 1), get_recipe_name($ids[0]), get_recipe_uri($ids[0]); + } else { + printf "%-24s | \n", $dt->ymd(); } $dt->add(days => 1); + if($dt->day_of_week == 1) { + $weekend_padding = "\n"; + } else { + $weekend_padding = ""; + } } } |