Diff for /capa/capa51/GUITools/capastats.tcl between versions 1.1 and 1.9

version 1.1, 1999/09/28 21:25:37 version 1.9, 2000/01/10 22:40:30
Line 41  proc runCapaTools { classDirConfigFile } Line 41  proc runCapaTools { classDirConfigFile }
 #    $utilsMenu add command -label "Email" -command ""  #    $utilsMenu add command -label "Email" -command ""
 #    $utilsMenu add command -label "View Score File" -command ""  #    $utilsMenu add command -label "View Score File" -command ""
     $utilsMenu add command -label "View Submissions" -command "CTsubmissions $num"      $utilsMenu add command -label "View Submissions" -command "CTsubmissions $num"
       $utilsMenu add command -label "Create a Class Report" -command "CTcreateReport $num"
     $utilsMenu add command -label "Analyze Class Report" -command "CTanalyzeReport $num"      $utilsMenu add command -label "Analyze Class Report" -command "CTanalyzeReport $num"
     $utilsMenu add command -label "Analyze Responses" -command "CTanalyzeScorer $num"      $utilsMenu add command -label "Analyze Responses" -command "CTanalyzeScorer $num"
     $utilsMenu add command -label "Graph a Responses Analysis" -command "CTgraphAnalyzeScorer $num"      $utilsMenu add command -label "Graph a Responses Analysis" -command "CTgraphAnalyzeScorer $num"
       $utilsMenu add command -label "Discussion Stats" -command "CTdiscussStats $num"
     $utilsMenu add command -label "Quit" -command "CTquit $num"      $utilsMenu add command -label "Quit" -command "CTquit $num"
     $utilsMenu post 0 0      $utilsMenu post 0 0
     Centre_Dialog $utilsMenu default      Centre_Dialog $utilsMenu default
Line 86  proc CTchangePath { num } { Line 88  proc CTchangePath { num } {
 ###########################################################  ###########################################################
 proc CTcapaStat2 { num } {  proc CTcapaStat2 { num } {
     global gFile gCT gUniqueNumber      global gFile gCT gUniqueNumber
     if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }     # if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }
       if {[set setId [pickSets [CTsetList $gFile($num)] single "Pick A Set" \
    $gCT($num)]] == "Cancel" } { return }
     set cmdnum [incr gUniqueNumber]      set cmdnum [incr gUniqueNumber]
     set gCT(cmd.$cmdnum) capastat      set gCT(cmd.$cmdnum) capastat
     if { [      if { [
Line 126  proc CTcapaStat2 { num } { Line 130  proc CTcapaStat2 { num } {
 ###########################################################  ###########################################################
 proc CTcapaStat { num } {  proc CTcapaStat { num } {
     global gFile gCT gUniqueNumber      global gFile gCT gUniqueNumber
     if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }  #    if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }
       if {[set setId [pickSets [CTsetList $gFile($num)] single "Pick A Set" \
    $gCT($num)]] == "Cancel" } { return }
     set cmdnum [incr gUniqueNumber]      set cmdnum [incr gUniqueNumber]
     set gCT(cmd.$cmdnum) capastat      set gCT(cmd.$cmdnum) capastat
     if { [      if { [
Line 160  proc CTcapaStat { num } { Line 166  proc CTcapaStat { num } {
 ###########################################################  ###########################################################
 proc CTlogAnalysis { num } {  proc CTlogAnalysis { num } {
     global gFile gUniqueNumber gCT      global gFile gUniqueNumber gCT
     if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }      #if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } { return }
           if {[set setId [pickSets [CTsetList $gFile($num)] single "Pick A Set" \
    $gCT($num)]] == "Cancel" } { return }
     set cmdnum [incr gUniqueNumber]      set cmdnum [incr gUniqueNumber]
     set gCT(cmd.$cmdnum) loganalysis      set gCT(cmd.$cmdnum) loganalysis
     CTdatestamp $cmdnum      CTdatestamp $cmdnum
Line 299  proc CTitemAnalysisStart { num } { Line 306  proc CTitemAnalysisStart { num } {
     unset gCT(cmd.$cmdnum)      unset gCT(cmd.$cmdnum)
  return   return
     }      }
     if { [set sets [getSetRange $gCT($num) $gFile($num)]] == "" } {   #    if { [set sets [getSetRange $gCT($num) [lindex $select 1]]] == "" } \{
       if { [set sets [pickSets [CTsetList [lindex $select 1]] \
    "extended" "Select Sets" $gCT($num)]] == "Cancel" } {
  unset gCT(cmd.$cmdnum)   unset gCT(cmd.$cmdnum)
  return    return 
     }      }
     CTdatestamp $cmdnum      CTdatestamp $cmdnum
     if { [ catch {CTitemAnalysisRange $cmdnum [lindex $select 1] \      if { [ catch {CTitemAnalysisRange $cmdnum [lindex $select 1] $sets } errors ] } { 
       [lindex $sets 0] [lindex $sets 1] } errors ] } {   
  displayError $errors    displayError $errors 
     }      }
     unset gCT(cmd.$cmdnum)      unset gCT(cmd.$cmdnum)
Line 333  proc CTitemCorrelationStart { num } { Line 341  proc CTitemCorrelationStart { num } {
     foreach path [lsort [array names gCapaConfig "$num.*_path"]] {      foreach path [lsort [array names gCapaConfig "$num.*_path"]] {
  lappend paths [list [lindex [split $path "."] 1] $gCapaConfig($path) ]    lappend paths [list [lindex [split $path "."] 1] $gCapaConfig($path) ] 
     }      }
     if { [set select [multipleChoice $gCT($num) "Select a class path" $paths ] ] == "" } {      if {[set select [multipleChoice $gCT($num) "Select a class path" $paths]] == ""} {
     unset gCT(cmd.$cmdnum)      unset gCT(cmd.$cmdnum)
  return   return
     }      }
     if { [set setId [getOneSet $gCT($num) $gFile($num)]] == "" } {       #if { [set setId [getOneSet $gCT($num) [lindex $select 1]]] == "" } \{ 
       if {[set setId [pickSets [CTsetList [lindex $select 1]] single "Pick A Set" \
    $gCT($num)]] == "Cancel" } {
  unset gCT(cmd.$cmdnum)   unset gCT(cmd.$cmdnum)
  return    return 
     }      }
Line 361  proc CTsubmissions { num } { Line 371  proc CTsubmissions { num } {
   
     set cmdnum [incr gUniqueNumber]      set cmdnum [incr gUniqueNumber]
     set gCT(cmd.$cmdnum) submissions      set gCT(cmd.$cmdnum) submissions
     if { "" == [set setlist [getSetRange $gCT($num) $gFile($num)]] } { return }      if { [set sets [pickSets [CTsetList $gFile($num)] \
    "extended" "Select Sets" $gCT($num)]] == "Cancel" } { return }
   #    if { "" == [set setlist [getSetRange $gCT($num) $gFile($num)]] } { return }
     CTdatestamp $cmdnum      CTdatestamp $cmdnum
     CTputs $cmdnum "Submissions for: $s_id, $s_name\n"      CTputs $cmdnum "Submissions for: $s_id, $s_name\n"
     displayStatus "Getting submissions" spinner $cmdnum      displayStatus "Getting submissions" spinner $cmdnum
     CTsubmissionsLaunch $num $cmdnum telnet $s_id $s_name \      CTsubmissionsLaunch $num $cmdnum telnet $s_id $s_name 0 $sets
  [lindex $setlist 0] [lindex $setlist 1]  }
   
   ###########################################################
   # CTcreateReport
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTcreateReport { num } {
       global gUniqueNumber gCT gFile
   
       set cmdnum [incr gUniqueNumber]
       set gCT(cmd.$cmdnum) createreport
       CTcreateReportDialog $num $cmdnum
 }  }
   
 ###########################################################  ###########################################################
Line 672  proc CTgraphAnalyzeScorer { num } { Line 696  proc CTgraphAnalyzeScorer { num } {
 }  }
   
 ###########################################################  ###########################################################
   # CTdiscussStats
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTdiscussStats { num } {
       global gCT gUniqueNumber gFile
       set cmdnum [incr gUniqueNumber]
       set gCT(cmd.$cmdnum) discussstats
       set file [file join $gFile($num) discussion logs access.log]
       displayStatus "Generating discussion Stats" both $cmdnum    
       CTdiscussForum $cmdnum $file $gFile($num) discussData 0
       CTputsDiscussResults $cmdnum discussData
       CToutput $num $cmdnum
       removeStatus $cmdnum
       unset gCT(cmd.$cmdnum)
   }
   
   ###########################################################
 # CTquit  # CTquit
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
Line 903  proc CTlogAnalysis2 { num cmdnum setId } Line 945  proc CTlogAnalysis2 { num cmdnum setId }
     set logFile [file join $gFile($num) records "log$setId.db"]      set logFile [file join $gFile($num) records "log$setId.db"]
     if { [file exists $logFile] } {      if { [file exists $logFile] } {
  CTputs $cmdnum "Log analysis for telnet session log$setId.db\n"    CTputs $cmdnum "Log analysis for telnet session log$setId.db\n" 
  CTscanLogDB $cmdnum $logFile l(Y) l(N) l(S) l(U) l(u)   CTscanLogDB $cmdnum $logFile l(Y) l(N) l(S) l(U) l(u) l(A) l(F)
     } else {      } else {
  set l(Y) [set l(N) [set l(S) [set l(U) [set l(u) 0]]]]   set l(Y) [set l(N) [set l(S) [set l(U) [set l(u) [set l(A) [set l(F) 0]]]]]]
     }      }
     set webLogFile [file join $gFile($num) records "weblog$setId.db" ]      set webLogFile [file join $gFile($num) records "weblog$setId.db" ]
     if { [file exists $webLogFile] } {      if { [file exists $webLogFile] } {
  CTputs $cmdnum "===============================================\n"   CTputs $cmdnum "===============================================\n"
  CTputs $cmdnum "Log analysis for web session weblog$setId.db\n"   CTputs $cmdnum "Log analysis for web session weblog$setId.db\n"
  CTscanLogDB $cmdnum $webLogFile w(Y) w(N) w(S) w(U) w(u)   CTscanLogDB $cmdnum $webLogFile w(Y) w(N) w(S) w(U) w(u) w(A) w(F)
     } else {      } else {
  set w(Y) [set w(N) [set w(S) [set w(U) [set w(u) 0]]]]   set w(Y) [set w(N) [set w(S) [set w(U) [set w(u) [set w(A) [set w(F) 0]]]]]]
     }      }
     set telnet_total [expr $l(Y)+$l(N)+$l(S)+$l(U)+$l(u)]      set telnet_total [expr $l(Y)+$l(N)+$l(S)+$l(U)+$l(u)+$l(A)+$l(F)]
     set web_total [expr $w(Y)+$w(N)+$w(S)+$w(U)+$w(u)]      set web_total [expr $w(Y)+$w(N)+$w(S)+$w(U)+$w(u)+$w(A)+$w(F)]
     CTputs $cmdnum "============== SUMMARY ====================\n"      CTputs $cmdnum "============== SUMMARY ====================\n"
     CTputs $cmdnum "            #Y     #N     #S     #U     #u    Total\n"      CTputs $cmdnum "            #Y     #N     #S     #U     #u    #A     #F     Total\n"
     CTputs $cmdnum [format "telnet: %6d %6d %6d %6d %6d   %6d\n" \      CTputs $cmdnum [format "telnet: %6d %6d %6d %6d %6d %6d %6d   %6d\n" \
        $l(Y) $l(N) $l(S) $l(U) $l(u) $telnet_total ]         $l(Y) $l(N) $l(S) $l(U) $l(u) $l(A) $l(F) $telnet_total ]
     CTputs $cmdnum [format "   web: %6d %6d %6d %6d %6d   %6d\n" \      CTputs $cmdnum [format "   web: %6d %6d %6d %6d %6d %6d %6d   %6d\n" \
        $w(Y) $w(N) $w(S) $w(U) $w(u) $web_total]         $w(Y) $w(N) $w(S) $w(U) $w(u) $w(A) $w(F) $web_total]
     foreach v { Y N S U u } {      foreach v { Y N S U u A F} {
  set sum($v) [expr $l($v) + $w($v)]   set sum($v) [expr $l($v) + $w($v)]
  if { $sum($v) > 0 } {    if { $sum($v) > 0 } { 
     set ratio($v) [expr 100.0*$w($v)/double($sum($v))]       set ratio($v) [expr 100.0*$w($v)/double($sum($v))] 
Line 937  proc CTlogAnalysis2 { num cmdnum setId } Line 979  proc CTlogAnalysis2 { num cmdnum setId }
     } else {      } else {
  set ratio(web) 0.0   set ratio(web) 0.0
     }      }
     CTputs $cmdnum [format "  %%web: % 6.1f % 6.1f % 6.1f % 6.1f % 6.1f   % 6.1f\n" \      CTputs $cmdnum [format "  %%web: % 6.1f % 6.1f % 6.1f % 6.1f % 6.1f % 6.1f % 6.1f   % 6.1f\n" \
  $ratio(Y) $ratio(N) $ratio(S) $ratio(U) $ratio(u) $ratio(web) ]   $ratio(Y) $ratio(N) $ratio(S) $ratio(U) $ratio(u) $ratio(A) $ratio(F) $ratio(web) ]
 }  }
   
   
Line 947  proc CTlogAnalysis2 { num cmdnum setId } Line 989  proc CTlogAnalysis2 { num cmdnum setId }
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 proc CTscanLogDB { num file Y_lVar N_lVar S_lVar U_lVar u_lVar } {  proc CTscanLogDB { num file Y_lVar N_lVar S_lVar U_lVar u_lVar A_lVar F_lVar } {
     upvar $Y_lVar Y_l      upvar $Y_lVar Y_l
     upvar $N_lVar N_l      upvar $N_lVar N_l
     upvar $S_lVar S_l      upvar $S_lVar S_l
     upvar $U_lVar U_l      upvar $U_lVar U_l
     upvar $u_lVar u_l      upvar $u_lVar u_l
       upvar $A_lVar A_l
       upvar $F_lVar F_l
           
     set line_cnt 0      set line_cnt 0
           
Line 972  proc CTscanLogDB { num file Y_lVar N_lVa Line 1016  proc CTscanLogDB { num file Y_lVar N_lVa
  if { ! [info exists count] } {   if { ! [info exists count] } {
     for { set i 0 } { $i < [llength $ans_char] } { incr i } {      for { set i 0 } { $i < [llength $ans_char] } { incr i } {
  set count(Y.$i) 0; set count(N.$i) 0; set count(S.$i) 0   set count(Y.$i) 0; set count(N.$i) 0; set count(S.$i) 0
  set count(U.$i) 0; set count(u.$i) 0   set count(U.$i) 0; set count(u.$i) 0; set count(A.$i) 0
    set count(F.$i) 0
     }      }
     set count(Y.total) 0; set count(N.total) 0; set count(S.total) 0      set count(Y.total) 0; set count(N.total) 0; set count(S.total) 0
     set count(U.total) 0; set count(u.total) 0      set count(U.total) 0; set count(u.total) 0; set count(A.total) 0
       set count(F.total) 0
  }   }
  set i -1   set i -1
  foreach char $ans_char {   foreach char $ans_char {
Line 983  proc CTscanLogDB { num file Y_lVar N_lVa Line 1029  proc CTscanLogDB { num file Y_lVar N_lVa
     if { $char == "-" } { continue }      if { $char == "-" } { continue }
     if { [catch {incr count($char.$i)}] } {      if { [catch {incr count($char.$i)}] } {
  set count(Y.$i) 0; set count(N.$i) 0; set count(S.$i) 0   set count(Y.$i) 0; set count(N.$i) 0; set count(S.$i) 0
  set count(U.$i) 0; set count(u.$i) 0   set count(U.$i) 0; set count(u.$i) 0; set count(A.$i) 0
    set count(F.$i) 0
  incr count($char.$i)   incr count($char.$i)
     }      }
     incr count($char.total)      incr count($char.total)
Line 992  proc CTscanLogDB { num file Y_lVar N_lVa Line 1039  proc CTscanLogDB { num file Y_lVar N_lVa
     }      }
     close $fileId      close $fileId
     removeStatus $num      removeStatus $num
     CTputs $num "Prob #:     #Y     #N     #S     #U     #u\n"      CTputs $num "Prob #:     #Y     #N     #S     #U     #u     #A     #F\n"
     for { set i 0 } { $i < [llength $ans_char] } { incr i } {      for { set i 0 } { $i < [llength $ans_char] } { incr i } {
  CTputs $num [format "    %2d: %6d %6d %6d %6d %6d\n"  [expr $i + 1] \   CTputs $num [format "    %2d: %6d %6d %6d %6d %6d %6d %6d\n"  [expr $i + 1] \
                      $count(Y.$i) $count(N.$i) $count(S.$i) $count(U.$i) $count(u.$i) ]                       $count(Y.$i) $count(N.$i) $count(S.$i) $count(U.$i) $count(u.$i) \
    $count(A.$i) $count(F.$i) ]
     }      }
     CTputs $num "===========================================\n"      CTputs $num "===========================================\n"
     CTputs $num [format " Total: %6d %6d %6d %6d %6d\n" $count(Y.total) $count(N.total) \      CTputs $num [format " Total: %6d %6d %6d %6d %6d %6d %6d\n" $count(Y.total) \
      $count(S.total) $count(U.total) $count(u.total) ]       $count(N.total) $count(S.total) $count(U.total) $count(u.total) \
        $count(A.total) $count(F.total) ]
     set Y_l $count(Y.total)      set Y_l $count(Y.total)
     set N_l $count(N.total)      set N_l $count(N.total)
     set S_l $count(S.total)      set S_l $count(S.total)
     set U_l $count(U.total)      set U_l $count(U.total)
     set u_l $count(u.total)      set u_l $count(u.total)
       set A_l $count(A.total)
       set F_l $count(F.total)
     return      return
 }  }
   
Line 1294  proc CTrunCommand { num cmdnum fileId {f Line 1345  proc CTrunCommand { num cmdnum fileId {f
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 proc CTitemAnalysisRange { num classpath setIdStart setIdEnd } {  proc CTitemAnalysisRange { num classpath sets } {
     for { set i $setIdStart } { $i <= $setIdEnd } { incr i } {       foreach i $sets {
  if { [ catch { CTitemAnalysis $num $classpath $i } errors ] } {    if { [ catch { CTitemAnalysis $num $classpath $i } errors ] } { 
     displayError $errors       displayError $errors 
  }   }
Line 1365  proc CTitemAnalysis { num classpath setI Line 1416  proc CTitemAnalysis { num classpath setI
  incr valid_cnt   incr valid_cnt
  set score 0   set score 0
  for { set ii 0 } { $ii < [llength $ans_char] } { incr ii } {   for { set ii 0 } { $ii < [llength $ans_char] } { incr ii } {
           #Can't use incr because the numbers might be doubles
     if { [lindex $ans_char $ii] == "Y" || \      if { [lindex $ans_char $ii] == "Y" || \
      [lindex $ans_char $ii] == "y" } {       [lindex $ans_char $ii] == "y" } {
  incr score [lindex $weights $ii]   catch {incr score [lindex $weights $ii]}
  set  Y_cnt($ii) [expr $Y_cnt($ii) + 1]   set Y_cnt($ii) [expr {$Y_cnt($ii) + 1}]
  set  Y_total    [expr $Y_total + 1]   set Y_total [expr {$Y_total + 1}]
     }      }
     if { [lindex $ans_char $ii] == "N" || \      if { [lindex $ans_char $ii] == "N" || \
      [lindex $ans_char $ii] == "n" } {       [lindex $ans_char $ii] == "n" } {
  set  N_cnt($ii) [expr $N_cnt($ii) + 1]   set N_cnt($ii) [expr {$N_cnt($ii) + 1}]
  set  N_total    [expr $N_total + 1]   set N_total  [expr {$N_total + 1}]
     }      }
     if { [lindex $ans_char $ii] >= 0 && \      if { [lindex $ans_char $ii] >= 0 && \
      [lindex $ans_char $ii] <= 9 } {       [lindex $ans_char $ii] <= 9 } {
  incr score [lindex $ans_char $ii]   incr score [lindex $ans_char $ii]
  set yes_part [expr [lindex $ans_char $ii] / \   if {[catch {set yes_part [expr [lindex $ans_char $ii] / \
   double([lindex $weights $ii]) ]        double([lindex $weights $ii])]}]} {
       set yes_part 1
    }
  set no_part [expr 1.0 - $yes_part]   set no_part [expr 1.0 - $yes_part]
  set Y_cnt($ii) [expr $Y_cnt($ii) + $yes_part]   set Y_cnt($ii) [expr $Y_cnt($ii) + $yes_part]
  set Y_total    [expr $Y_total + $yes_part]   set Y_total    [expr $Y_total + $yes_part]
Line 1483  proc CTitemCorrelation { num classpath s Line 1536  proc CTitemCorrelation { num classpath s
     updateStatusBar [expr {$line_cnt/double($maxLine)}] $num      updateStatusBar [expr {$line_cnt/double($maxLine)}] $num
  }   }
  if { $line_cnt == 2 } {    if { $line_cnt == 2 } { 
     set aline [string trim $aline]      set aline [string trimright $aline]
     set weights [split $aline {}]      set weights [split $aline {}]
  }    } 
  if { $line_cnt > 3} {   if { $line_cnt > 3} {
     set aline [string trim $aline]      set aline [string trimright $aline]
     set data  [string range $aline 10 end]      set data  [string range $aline 10 end]
     set ans_str [lindex [split $data ","] 0]      set ans_str [lindex [split $data ","] 0]
     set ans_char_list [split $ans_str {} ]      set ans_char_list [split $ans_str {} ]
Line 1548  proc CTitemCorrelation { num classpath s Line 1601  proc CTitemCorrelation { num classpath s
     close $fileId      close $fileId
     removeStatus $num      removeStatus $num
     # print out the correlation matrix      # print out the correlation matrix
 #    parray sum_x      #parray sum_x
 #    parray sum_y      #parray sum_y
 #    parray prod_xy      #parray prod_xy
       #puts $question_cnt
     CTputs $num "   "      CTputs $num "   "
     for { set ii 1 } { $ii < $question_cnt } { incr ii } {      for { set ii 1 } { $ii < $question_cnt } { incr ii } {
  CTputs $num [format "    %2d" [expr {$ii+1}] ]   CTputs $num [format "    %2d" [expr {$ii+1}] ]
Line 1593  proc CTitemCorrelation { num classpath s Line 1647  proc CTitemCorrelation { num classpath s
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
 proc CTsubmissionsLaunch { num cmdnum type s_id s_nm start end } {  proc CTsubmissionsLaunch { num cmdnum type s_id s_nm index setlist } {
     global gCT gFile gUniqueNumber gCapaConfig      global gCT gFile gUniqueNumber gCapaConfig
   
     CTputs $cmdnum "$type submissions for $s_nm for set $start\n"      set curset [lindex $setlist $index]
       CTputs $cmdnum "$type submissions for $s_nm for set $curset\n"
     if { $type == "telnet" } {      if { $type == "telnet" } {
  set command "grep -i $s_id [file join $gFile($num) records submissions$start.db]"   set command "grep -i $s_id [file join $gFile($num) records submissions$curset.db]"
  set followtype web   set followtype web
     } else {      } else {
  set command "grep -i $s_id [file join $gFile($num) \   set command "grep -i $s_id [file join $gFile($num) \
                        records websubmissions$start.db]"                         records websubmissions$curset.db]"
  set followtype telnet   set followtype telnet
  incr start   incr index
     }      }
     set done 0      set done 0
     set followcmd ""      set followcmd ""
     while { !$done && ($start <= ($end+1)) } {      while { !$done && ($index <= [llength $setlist]) } {
  if { $start <= $end } {   if { [lindex $setlist $index] != "" } {
     set followcmd "CTsubmissionsLaunch $num $cmdnum $followtype $s_id {$s_nm} \      set followcmd "CTsubmissionsLaunch $num $cmdnum $followtype $s_id {$s_nm} \
                             $start $end"                              $index \"$setlist\""
  }   }
  if { ! [catch {set fileId [open "|$command" "r"]} ] } { set done 1 }   if { ![catch {set fileId [open "|$command" "r"]} error ] } { set done 1 } 
     }      }
     fconfigure $fileId -blocking 0      fconfigure $fileId -blocking 0
     fileevent $fileId readable "CTrunCommand $num $cmdnum $fileId {$followcmd}"      fileevent $fileId readable "CTrunCommand $num $cmdnum $fileId {$followcmd}"
Line 1910  proc CToutput { num cmdnum } { Line 1965  proc CToutput { num cmdnum } {
  pack $buttonFrame.wrap $buttonFrame.save $buttonFrame.print \   pack $buttonFrame.wrap $buttonFrame.save $buttonFrame.print \
     $buttonFrame.dismiss -side left      $buttonFrame.dismiss -side left
     }      }
     set index [$gCT($num.output) index end]      set index [$gCT($num.output) index end-1c]
     foreach line $gCT(output.$cmdnum) {      foreach line $gCT(output.$cmdnum) {
  eval $gCT($num.output) insert end $line   eval $gCT($num.output) insert end $line
     }      }
Line 2180  proc CTdrawBargraph { num } { Line 2235  proc CTdrawBargraph { num } {
  if { [set color [lindex $datum 3]] == "" } {set color $gBarGraph($num.color)}   if { [set color [lindex $datum 3]] == "" } {set color $gBarGraph($num.color)}
  if { $gBarGraph($num.bucketscores) && ($i % $howoften == $when) } {   if { $gBarGraph($num.bucketscores) && ($i % $howoften == $when) } {
     if { $i == $when } {      if { $i == $when } {
  puts "$value-$which-$howoften"  # puts "$value-$which-$howoften"
  $canvas create rectangle $textwidth \   $canvas create rectangle $textwidth \
     $y1 $x2 $y2 -fill $color -tag $tag      $y1 $x2 $y2 -fill $color -tag $tag
     } else {      } else {
  puts "$value:$which:$howoften"  # puts "$value:$which:$howoften"
  $canvas create rectangle [expr {$eachwidth*($i-$howoften+1)+$textwidth}]\   $canvas create rectangle [expr {$eachwidth*($i-$howoften+1)+$textwidth}]\
     $y1 $x2 $y2 -fill $color -tag $tag      $y1 $x2 $y2 -fill $color -tag $tag
     }      }
Line 2605  proc CTcreateSubset { num cmdnum day set Line 2660  proc CTcreateSubset { num cmdnum day set
     catch {unset answerArray}      catch {unset answerArray}
     catch {unset exist}      catch {unset exist}
 }  }
   
   ###########################################################
   # CTdiscussForum
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTdiscussForum { num file dir resultVar {specificSet 0}} {
       global gCT
       upvar $resultVar result
   
       if { $specificSet == 0 } {
    set start 1
       } else {
    set start $specificSet
       }
       set fileId [open $file r]
       set maxLine [lindex [exec wc $file] 0]
       set aline [gets $fileId]
       set last 0
       set line_cnt 0
       while {![eof $fileId]} {
    incr line_cnt
    if { ($line_cnt%20) == 0 } { updateStatusBar [expr $line_cnt/double($maxLine)] $num }
    foreach {stunum capaid name email action set prob date time} [split $aline "|"] {}
    if {$specificSet && ($specificSet == $set)} {set aline [gets $fileId];continue}
    if { $action == "ViewProblem" } {
       if { [catch {incr count($set,$prob)}]} {
    set count($set,$prob) 1
    if { $set > $last } { set last $set }
    if { [catch {set max($set)}]} { set max($set) 0 }
    if { $prob > $max($set)} { set max($set) $prob }
    if { [catch {set posts($set,$prob) [llength [glob $dir/discussion/$set/[format "%06d" $prob]-*-*-*.msg]]}]} { set posts($set,$prob) 0 }
       }
       set ever($name) 1
       set names($set,$name) 1
       set nameprob($set,$prob,$name) 1
    }
    set aline [gets $fileId]
       }
   
       updateStatusMessage "Summarizing Data" $num
       updateStatusBar 0 $num
       for {set i 1} { $i <= $last } { incr i } {
    updateStatusBar [expr $i/$last] $num 
    set total($i) 0
    for {set j 1} { $j <= $max($i) } { incr j } {
       set message ""
       if {[catch { set result($num.$i.$j.posts) $posts($i,$j) }]} {
    set result($num.$i.$j.posts) 0
       }
       if {[catch {set result($num.$i.$j.views) $count($i,$j)}]} {
    set result($num.$i.$j.views) 0
       } 
       catch {incr total($i) $count($i,$j)}
       if { [catch { set result($num.$i.$j.ratio) \
         [expr $result($num.$i.$j.views)/double($result($num.$i.$j.posts))]} error]} {
    set result($num.$i.$j.ratio) 0.0
       }
       set result($num.$i.$j.viewers) [llength [array names nameprob $i,$j,*]]
    }
    set result($num.$i.views) $total($i)
    set result($num.$i.max) $max($i)
       }
       
       for {set i 1} { $i<=$last } { incr i } {
    set result($num.$i.viewers) [llength [array names names $i,*]]
       }
       close $fileId
       set result($num.viewers) [llength [array names ever]]
       set result($num.last) $last
       #IDEAS: stick into capastats
       #     : howmany viws are repeats
       #     : Student Course Profile, add #ViewProblems #Posts
       #     : add some portion of these stats to analyze log files?
   }
   
   ###########################################################
   # CTputsDiscussResults
   ###########################################################
   ###########################################################
   proc CTputsDiscussResults { num resultsVar } {
       upvar $resultsVar result
       for {set i 1} { $i <= $result($num.last) } { incr i } {
    CTputs $num "For Set $i #Visitors:$result($num.$i.viewers) did #views:$result($num.$i.views)\n"
           CTputs $num "Prob# #Posts #Views Ratio #UniqueStu\n"
    CTputs $num "------------------------------------\n"  
    for {set j 1} { $j <= $result($num.$i.max)} { incr j } {
       CTputs $num [format "%5d %6d %6d %5s %6d\n" $j \
        $result($num.$i.$j.posts) $result($num.$i.$j.views) \
        [if {$result($num.$i.$j.ratio) == 0.0} {set temp " "} \
     {format %.1f $result($num.$i.$j.ratio)}] \
        $result($num.$i.$j.viewers)]
    }
       }
       CTputs $num "Overall Unique #viewers: $result($num.viewers)\n"
   }
   
   ###########################################################
   # CTcreateReportDialog
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTcreateReportDialog { num cmdnum } {
       global gCT gFile
   
       
       set gCT(summary.section.$cmdnum) 1
       set gCT(summary.set.$cmdnum) 1
   
       set summary [toplevel $gCT($num).summary]
       set whoFrame [frame $summary.whoFrame -borderwidth 4 -relief groove]
       set whichFrame [frame $summary.whichFrame -borderwidth 4 -relief groove]
       set sortFrame [frame $summary.sortFrame]
       set file2Frame [frame $summary.file2Frame]
       set buttonFrame [frame $summary.buttonFrame]
       pack $whoFrame $whichFrame $sortFrame $file2Frame $buttonFrame -side top
       pack configure $whoFrame $whichFrame -padx 10 -pady 10
   
       set sectionFrame [frame $whoFrame.section]
       set allFrame [frame $whoFrame.all]
       pack $sectionFrame $allFrame -side top
   
       set gCT(summary.who.$cmdnum) section
   
       radiobutton $sectionFrame.section -text \
       "For students in default section:" -variable gCT(summary.who.$cmdnum) \
       -value section 
       entry $sectionFrame.entry -textvariable gCT(summary.section.$cmdnum) -width 3 
       pack $sectionFrame.section $sectionFrame.entry -side left
   
       radiobutton $allFrame.all -text "For all students in the class" \
       -variable gCT(summary.who.$cmdnum) -value all 
       pack $allFrame.all
   
       set sectionFrame [frame $whichFrame.section]
       set allFrame [frame $whichFrame.all]
       pack $sectionFrame $allFrame -side top
   
       set gCT(summary.which.$cmdnum) specific
   
       radiobutton $sectionFrame.section -text "For set:" \
       -variable gCT(summary.which.$cmdnum) -value specific 
       entry $sectionFrame.entry -textvariable gCT(summary.set.$cmdnum) -width 3 
       pack $sectionFrame.section $sectionFrame.entry -side left
   
       radiobutton $allFrame.all -text "For all sets up to:" -variable \
       gCT(summary.which.$cmdnum) -value upto 
       entry $allFrame.entry -textvariable gCT(summary.set.$cmdnum) -width 3 
       pack $allFrame.all $allFrame.entry -side left
   
       set firstFrame [frame $sortFrame.firstFrame -borderwidth 4 -relief groove]
       set secondFrame [frame $sortFrame.secondFrame -borderwidth 4 \
       -relief groove]
       pack $firstFrame $secondFrame -side left
   
       set gCT(summary.first.$cmdnum) name
   
       label $firstFrame.label -text "Sorting Order - Primary"
       radiobutton $firstFrame.name -text "Student Name" -variable \
       gCT(summary.first.$cmdnum) -value name
       radiobutton $firstFrame.number -text "Student Number" -variable \
       gCT(summary.first.$cmdnum) -value number
       radiobutton $firstFrame.section -text "Section" -variable \
       gCT(summary.first.$cmdnum) -value section
       radiobutton $firstFrame.grade -text "Grade" -variable gCT(summary.first.$cmdnum) \
       -value grade
       pack $firstFrame.label $firstFrame.name $firstFrame.number \
       $firstFrame.section $firstFrame.grade -side top -anchor w
   
       set gCT(summary.second.$cmdnum) number
   
       label $secondFrame.label -text "Sorting Order - Secondary"
       radiobutton $secondFrame.name -text "Student Name" -variable \
       gCT(summary.second.$cmdnum) -value name
       radiobutton $secondFrame.number -text "Student Number" -variable \
       gCT(summary.second.$cmdnum) -value number
       radiobutton $secondFrame.section -text "Section" -variable \
       gCT(summary.second.$cmdnum) -value section
       radiobutton $secondFrame.grade -text "Grade" -variable gCT(summary.second.$cmdnum) \
       -value grade
       pack $secondFrame.label $secondFrame.name $secondFrame.number \
       $secondFrame.section $secondFrame.grade -side top -anchor w
   
       set defaultFrame [frame $file2Frame.defaultFrame]
       set fileFrame [frame $file2Frame.fileFrame]
       pack $defaultFrame $fileFrame -side top
   
       set gCT(summary.filename.$cmdnum) default 
   
       radiobutton $defaultFrame.default -text "Grader Chooses File Name" \
    -variable gCT(summary.filename.$cmdnum) -value default
       pack $defaultFrame.default
   
       radiobutton $fileFrame.label -text "Specified Output File:" \
    -variable gCT(summary.filename.$cmdnum) -value specified
       set entryFrame [frame $fileFrame.entryFrame]
       button $fileFrame.select -text "Select File" \
       -command "CTselectOutputFile $cmdnum"
       pack $fileFrame.label $entryFrame $fileFrame.select -side left
       entry $entryFrame.entry -textvariable gCT(summary.file.$cmdnum) \
    -xscrollcommand "$entryFrame.scroll set"
       scrollbar $entryFrame.scroll -orient h -command \
       "$entryFrame.entry xview"
       pack $entryFrame.entry $entryFrame.scroll
       pack configure $entryFrame.scroll -fill x
   
       button $buttonFrame.create -text "Create" -command \
       "removeWindowEntry Summary
                destroy $summary
                CTcreateSummaryReport $num $cmdnum"
       button $buttonFrame.cancel -text "Cancel" -command \
       "removeWindowEntry Summary
                destroy $summary"
       pack $buttonFrame.create $buttonFrame.cancel -side left
   
       Centre_Dialog $summary default
   }
   
   ###########################################################
   # CTselectOutputFile
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTselectOutputFile { num } {
       global gCT
       set gCT(summary.filename.$num) specified
       if { "" != [ set temp [tk_getSaveFile] ] } {set gCT(summary.file.$num) $temp}
   }    
   
   ###########################################################
   # CTcreateSummaryReport
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTcreateSummaryReport { num cmdnum } {
       global gCT gFile
   
       displayStatus "Opening File" both $cmdnum
   
       switch $gCT(summary.who.$cmdnum) {
    all {
       set file ClassSet$gCT(summary.set.$cmdnum).rpt
    }
    section {
       set file Sec$gCT(summary.section.$cmdnum)Set$gCT(summary.set.$cmdnum).rpt 
    }
    default {
       displayError "An error has occured while creating a summary \
       report $gCT(summary.section.$cmdnum)"
       return
    }
       }
   
       if { $gCT(summary.filename.$cmdnum) == "specified" } { 
    set file $gCT(summary.file.$cmdnum)
       }
       if { $file == "" } { 
    removeStatus
    displayError "Must specify a valid filename"
    return
       }
       updateStatusMessage "Creating Summary" $cmdnum
   
       set cwd [pwd]
       cd $gFile($num)
       set error [ catch {CTcreateSummary $file $cmdnum} ]
       cd $cwd
   
       removeStatus $cmdnum
   
       if {!$error && "Yes" == [makeSure \
          "Created summary file $file, would you like to see it?"]} {
    set fileId [open [file join $gFile($num) $file] r]
    CTputs $cmdnum [read $fileId]
    CToutput $num $cmdnum 
       }
   }
   
   ###########################################################
   # CTsetList
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTsetList { file } {
       set list ""
       for { set i 0 } { $i < 100 } { incr i } {
    if { [file readable [file join $file records set$i.db]] } {
       lappend list $i
    }
       }
       return $list
   }
   

Removed from v.1.1  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>