diff parsedata.pl @ 145:c028506aa9cc

Separate the concepts of "every other week" classes and split group classes.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Sep 2014 12:44:10 +0300
parents 4faf9956741b
children 1a5994671dcf
line wrap: on
line diff
--- a/parsedata.pl	Tue Sep 09 11:21:32 2014 +0300
+++ b/parsedata.pl	Wed Sep 10 12:44:10 2014 +0300
@@ -287,6 +287,7 @@
   my ($l, $rowspan) = @_;
   my $chours = $rowspan / 2; # The table is actually in half cells
   my $cdata = [];
+  my $cturns = 0;
   my $cgrouped = 0;
 
   # Pull in data for the class/hour cell
@@ -297,9 +298,14 @@
           my $text = $$b{"nodes"}[0]{"text"};
           $text =~ s/\.$//;
 
-          $cgrouped = 1 if ($text =~ /vuorov/);
-
-          push(@$cdata, $text);
+          if ($text =~ /vuorov/i)
+          {
+            $cturns = 1;
+          }
+          else
+          {
+            push(@$cdata, $text);
+          }
         }
       }
     }
@@ -341,11 +347,11 @@
         push(@$cdata1, $$cdata[$i]) if defined($$cdata[$i]);
         push(@$cdata2, $$cdata[$i+1]) if defined($$cdata[$i+1]);
       }
-      $$hourDefs{$cid} = { "grouped" => $cgrouped, "start" => $lastHour, "hours" => $chours, "data" => [ $cdata1, $cdata2 ] };
+      $$hourDefs{$cid} = { "turns" => $cturns, "split" => $cgrouped, "start" => $lastHour, "hours" => $chours, "data" => [ $cdata1, $cdata2 ] };
     }
     else
     {
-      $$hourDefs{$cid} = { "grouped" => $cgrouped, "start" => $lastHour, "hours" => $chours, "data" => [ $cdata ] };
+      $$hourDefs{$cid} = { "turns" => $cturns, "split" => $cgrouped, "start" => $lastHour, "hours" => $chours, "data" => [ $cdata ] };
     }
 
     push(@{$$hourTable{$cday}}, $tid);