summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas <dr@jones.dk>2013-06-01 14:15:19 +0200
committerJonas <dr@jones.dk>2013-06-01 14:15:19 +0200
commitf8d53f5ffb5e51f9d6e9156d43491ea5c8ac9039 (patch)
treed69cc4a5ec4574e849e79b2689fb4cd45d57757a
parentb8b600d081fb4b2c96dee344348bfad475a6cda6 (diff)
Fix handle multiple hourspecs for same weekdays.
-rwxr-xr-xbin/rdf2hours22
1 files changed, 12 insertions, 10 deletions
diff --git a/bin/rdf2hours b/bin/rdf2hours
index 6fe6472..f40c921 100755
--- a/bin/rdf2hours
+++ b/bin/rdf2hours
@@ -169,10 +169,6 @@ while ( my $row = $iterator->next ) {
$weekdays = 0 unless ($weekdays);
my $weekdays_key = titledescribe( $weekdays, $speccomment );
-# FIXME: support multiple specbundles on same days (e.g. Gaardstronomi sommer siesta)
-# $weekdays_key .= daterangedescribe($specfrom, $specthrough)
-# if ( ($specfrom) and ($specthrough) );
-
$data{$category}{$name_key}{name} = $name;
$data{$category}{$name_key}{specbundle}{$specbundle_key}{locationcomment} = $locationcomment;
$data{$category}{$name_key}{specbundle}{$specbundle_key}{speclabel} = $speclabel;
@@ -181,7 +177,10 @@ while ( my $row = $iterator->next ) {
$data{$category}{$name_key}{specbundle}{$specbundle_key}{spec}{$weekdays_key}{weekdays} = $weekdays;
# TODO: extend SPARQL to cover specs without opens/closes, or drop below check
if ($opens and $closes) {
- $data{$category}{$name_key}{specbundle}{$specbundle_key}{spec}{$weekdays_key}{spec} = "$opens - $closes";
+ my $hours_key = $opens;
+ $hours_key =~ s/\b(\d)\b/0$1/g;
+ my $hourrange = "$opens - $closes";
+ $data{$category}{$name_key}{specbundle}{$specbundle_key}{spec}{$weekdays_key}{hours}{$hours_key} = $hourrange;
$data{$category}{$name_key}{specbundle}{$specbundle_key}{spec}{$weekdays_key}{speccomment} = $speccomment;
}
}
@@ -223,11 +222,14 @@ for my $category ( @category ) {
$data{$category}{$name}{specbundle}{$specbundle}{spec}{$weekdays}{speccomment},
);
push @specbundle, br if (@specbundle);
- push @specbundle, "\n", span(
- span($specdescription, ":"),
- "\t",
- span($data{$category}{$name}{specbundle}{$specbundle}{spec}{$weekdays}{spec}),
- );
+ # TODO: Tighten display of additive hours for same weekdays
+ for my $hours ( sort keys %{ $data{$category}{$name}{specbundle}{$specbundle}{spec}{$weekdays}{hours} } ) {
+ push @specbundle, "\n", span(
+ span($specdescription, ":"),
+ "\t",
+ span($data{$category}{$name}{specbundle}{$specbundle}{spec}{$weekdays}{hours}{$hours}),
+ );
+ }
}
# TODO: make simplified html (preferred for Scribus) optional
# push @content, p("\n", @specbundle) if (@specbundle);