summaryrefslogtreecommitdiff
path: root/utils/rhrd-schedules
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rhrd-schedules')
-rwxr-xr-xutils/rhrd-schedules29
1 files changed, 17 insertions, 12 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index a1e2d2f..fd74380 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -60,18 +60,18 @@ sub generate
sub show__day
{
- my ($ctx, @date) = @_;
+ my ($ctx, $year, $month, $day) = @_;
- print "https://pv.helsinki.at/export/day_schedule/$date[0]/$date[1]/$date[2]\n";
+ print "https://pv.helsinki.at/export/day_schedule/$year/$month/$day\n";
- my ($ret, $data) = RHRD::utils::fetch_parse_json("https://pv.helsinki.at/export/day_schedule/$date[0]/$date[1]/$date[2]", "rhrd-schedules");
+ my ($ret, $data) = RHRD::utils::fetch_parse_json("https://pv.helsinki.at/export/day_schedule/$year/$month/$day", "rhrd-schedules");
if(!$ret) {
print STDERR "Error fetching export from PV: $data\n";
return 1;
}
- my $dow = Date::Calc::Day_of_Week(@date);
- my $week = RHRD::utils::get_rd_week(DateTime->new(year => $date[0], month => $date[1], day => $date[2], hour => 12));
+ my $dow = Date::Calc::Day_of_Week($year, $month, $day);
+ my $week = RHRD::utils::get_rd_week(DateTime->new(year => $year, month => $month, day => $day, hour => 12));
my $errcnt = 0;
for my $entry (@{$data}) {
@@ -125,14 +125,19 @@ sub show
{
my ($ctx, $week, $dow) = @_;
- # TODO: parse week number and day
-
- my @date = (2016, 4, 14);
+ my @dates = ();
-# print "$date[0].$date[1].$date[2] (" . Date::Calc::Day_of_Week_to_Text() . "):\n";
- print Date::Calc::Date_to_Text(@date) . ":\n";
- my $errcnt = show__day($ctx, @date);
- print " -> $errcnt errors.\n\n";
+ # TODO: parse week number and day
+ my @d1 = (2016, 4, 14);
+ my @d2 = (2016, 4, 15);
+ $dates[0] = \@d1;
+ $dates[1] = \@d2;
+
+ for my $date (@dates) {
+ print Date::Calc::Date_to_Text(@{$date}) . ":\n";
+ my $errcnt = show__day($ctx, @{$date});
+ print " -> $errcnt errors.\n\n";
+ }
return 0;
}