--- capa/capa51/GUITools/capastats.tcl 2000/07/07 18:25:12 1.15 +++ capa/capa51/GUITools/capastats.tcl 2000/10/17 18:28:24 1.18 @@ -2,16 +2,16 @@ # Copyright (C) 1992-2000 Michigan State University # # The CAPA system is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public License as +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # The CAPA system is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. +# General Public License for more details. # -# You should have received a copy of the GNU Library General Public +# You should have received a copy of the GNU General Public # License along with the CAPA system; see the file COPYING. If not, # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. @@ -51,9 +51,9 @@ proc runCapaTools { classDirConfigFile } $utilsMenu add command -label "Change Class path" -command "CTchangePath $num" $utilsMenu add command -label "Run capastat" -command "CTcapaStat $num" - $utilsMenu add command -label "Run capastat2" -command "CTcapaStat2 $num" + $utilsMenu add command -label "Time Range capastat" -command "CTcapaStat2 $num" $utilsMenu add command -label "Summarize Log files" -command "CTlogAnalysis $num" - $utilsMenu add command -label "Student Course Profile" -command \ + $utilsMenu add command -label "Student Course Record" -command \ "CTstartStudentCourseProfile $num" $utilsMenu add command -label "CAPA IDs for one student" \ -command "CToneStudentCapaID $num" @@ -123,7 +123,7 @@ proc CTcapaStat2 { num } { set start [lindex $day 0] set startf [clock format [lindex $day 0] -format "%b %d %R %Y"] set end [lindex $day 1] - set endf [clock format [lindex $day 0] -format "%b %d %R %Y"] + set endf [clock format [lindex $day 1] -format "%b %d %R %Y"] set file [file join $gFile($num) records "subset$setId.db"] displayStatus "Generating [file tail $file]" both $cmdnum CTcreateSubset $num $cmdnum $start $end $setId @@ -2879,10 +2879,10 @@ proc updateDate { type cmdnum args } { proc CTgetWhen { num cmdnum setId } { global gFile gCT gPromptGDR - set firstsection [exec head [file join $gFile($num) records log$setId.db]] - append firstsection [exec head [file join $gFile($num) records weblog$setId.db]] - set lastsection [exec tail [file join $gFile($num) records log$setId.db]] - append lastsection [exec tail [file join $gFile($num) records weblog$setId.db]] + catch {set firstsection [exec head [file join $gFile($num) records log$setId.db]]} + catch {append firstsection [exec head [file join $gFile($num) records weblog$setId.db]]} + catch {set lastsection [exec tail [file join $gFile($num) records log$setId.db]]} + catch {append lastsection [exec tail [file join $gFile($num) records weblog$setId.db]]} set earliest -1 foreach line [split $firstsection \n] { @@ -2892,10 +2892,17 @@ proc CTgetWhen { num cmdnum setId } { if { $date < $earliest } { set earliest $date } } if { $earliest == -1 } { - file stat [file join $gFile($num) records log$setId.db] stat - set earliest $stat(ctime) + catch { + file stat [file join $gFile($num) records log$setId.db] stat + set earliest $stat(ctime) + } + catch { + file stat [file join $gFile($num) records log$setId.db] stat + if {($earliest ==-1) || ($stat(ctime) < $earliest)} { + set earliest $stat(ctime) + } + } } - set latest 0 foreach line [split $lastsection \n] { if { [catch {set date [clock scan [string range $line 10 33]]}]} {set date 0} @@ -2904,8 +2911,15 @@ proc CTgetWhen { num cmdnum setId } { if { $date > $latest } { set latest $date } } if { $latest == 0 } { - file stat [file join $gFile($num) records log$setId.db] stat - set latest $stat(mtime) + catch { + file stat [file join $gFile($num) records log$setId.db] stat + set latest $stat(mtime) + } + catch { + file stat [file join $gFile($num) records log$setId.db] stat + if { $latest == 0 } { set latest $date } + if { $stat(mtime) > $latest } { set latest $date } + } } #puts "$latest $earliest" @@ -2967,7 +2981,7 @@ proc CTgetWhen { num cmdnum setId } { ########################################################### proc CTscanDB { num file outId startdate enddate } { global answerArray exist - if {[catch {set fileId [open $file r]}]} { retun 0 } + if {[catch {set fileId [open $file r]}]} { return 0 } set Yes_cnt 0 set No_cnt 0 set line_cnt 0