fixed import of ht stats so it doesn't include last month since that is always No...
authorOwen Leonard <owen@balawis.leonard.fam>
Mon, 20 Sep 2010 20:58:13 +0000 (14:58 -0600)
committerOwen Leonard <owen@balawis.leonard.fam>
Mon, 20 Sep 2010 20:58:13 +0000 (14:58 -0600)
bin/import_ward_data
inc/class.tc.inc.php

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)
                        {
index 156f1ba8a4c3a8109d45066006e8cf2985f366e5..54283fc37655e35006ab5942820ef5875eda1d9d 100644 (file)
@@ -2101,7 +2101,7 @@ class tc
                        foreach ($new_data as $entry) {
                                $visit_notes = $entry['notes'];
                                $family = $entry['family_id'];
-                               $visit_pri = $entry['pri'];
+                               $visit_pri = $entry['pri'];
                                // Perform database save actions here
                                $this->db->query("SELECT * FROM tc_family WHERE family='$family'",__LINE__,__FILE__);
                                if ($this->db->next_record()) {