fixed import of ht stats so it doesn't include last month since that is always No...
[eq/.git] / bin / import_ward_data
index 68ee95d2d60ced3d2bd1a40a0a8227b5f7482be8..a9e70c6f3136a709f74afd4ae9fd72b8c4697bb7 100755 (executable)
@@ -402,6 +402,8 @@ sub update_tc_visit_table
        ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
        my %visit_status = ('X', 'y', '-', 'n', '', '');
        
+       $sth = $dbh->prepare("TRUNCATE TABLE tc_visit");
+       $sth->execute or die "-E- DB error: $DBI::errstr\n";
        foreach $index (keys %hometeaching_stats_data)
        {
                $hashref = $hometeaching_stats_data{$index};
@@ -448,7 +450,7 @@ sub update_tc_visit_table
                #print "$month_header\n";
                #print $hometeaching_stats_data{$index}{$month_header};
                #print "\n";
-               foreach $i (reverse(0..$#history)) {
+               foreach $i (reverse(0..$#history-1)) {
                        # went back a calendar year, decrement $data_year
                        if ($months{$data_months[$i]} > $data_month)
                        {