--- capa/capa51/GUITools/capastats.tcl 2000/03/22 21:08:02 1.14 +++ capa/capa51/GUITools/capastats.tcl 2000/10/17 18:28:24 1.18 @@ -1,3 +1,26 @@ +# capastatistics generator +# 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 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 +# General Public License for more details. +# +# 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. +# +# As a special exception, you have permission to link this program +# with the TtH/TtM library and distribute executables, as long as you +# follow the requirements of the GNU GPL in regard to all of the +# software in the executable aside from TtH/TtM. + ########################################################### # runCapaTools ########################################################### @@ -28,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" @@ -100,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 @@ -2856,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] { @@ -2869,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} @@ -2881,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" @@ -2944,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