Diff for /capa/capa51/GUITools/capastats.tcl between versions 1.6 and 1.12

version 1.6, 1999/11/02 19:10:44 version 1.12, 2000/02/02 19:14:10
Line 88  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 128  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 162  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 301  proc CTitemAnalysisStart { num } { Line 306  proc CTitemAnalysisStart { num } {
     unset gCT(cmd.$cmdnum)      unset gCT(cmd.$cmdnum)
  return   return
     }      }
     if { [set sets [getSetRange $gCT($num) [lindex $select 1]]] == "" } {   #    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 335  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) [lindex $select 1]]] == "" } {       #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 363  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]  
 }  }
   
 ###########################################################  ###########################################################
Line 1090  proc CTcollectSetScores { num path id on Line 1099  proc CTcollectSetScores { num path id on
     set char [lindex $ans_char $i]      set char [lindex $ans_char $i]
     if { $char == "N" || $char == "n"} { set found 1 }      if { $char == "N" || $char == "n"} { set found 1 }
     if { $char == "Y" || $char == "y"} {       if { $char == "Y" || $char == "y"} { 
  incr score [lindex $weights $i];set found 1   catch {incr score [lindex $weights $i]}
    set found 1
     }      }
     if { $char >= 0 && $char <= 9 } {       if { $char >= 0 && $char <= 9 } { 
  incr score $char;set found 1   incr score $char;set found 1
     }      }
     if { $char == "E" } {      if { $char == "E" } {
  incr valid_weights "-[lindex $weights $i]"   catch {incr valid_weights "-[lindex $weights $i]"}
     }      }
  }   }
  incr total_scores $score   incr total_scores $score
Line 1336  proc CTrunCommand { num cmdnum fileId {f Line 1346  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 1407  proc CTitemAnalysis { num classpath setI Line 1417  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 1561  proc CTitemCorrelation { num classpath s Line 1573  proc CTitemCorrelation { num classpath s
  ## $ans_char($ii) is one of 0 .. 9, Y, y, N, n   ## $ans_char($ii) is one of 0 .. 9, Y, y, N, n
  ## $ans_char($jj) is one of 0 .. 9, Y, y, N, n   ## $ans_char($jj) is one of 0 .. 9, Y, y, N, n
  if { $ans_char($ii) == "Y" || $ans_char($ii) == "y" } {   if { $ans_char($ii) == "Y" || $ans_char($ii) == "y" } {
     set x_data [lindex $weights $ii]      if {[set x_data [lindex $weights $ii]]==""} {set x_data 0}
  } elseif { $ans_char($ii) == "N" || $ans_char($ii) == "n" } {   } elseif { $ans_char($ii) == "N" || $ans_char($ii) == "n" } {
     set x_data 0      set x_data 0
  } else { ## must be in 0 .. 9   } else { ## must be in 0 .. 9
     set x_data $ans_char($ii)      set x_data $ans_char($ii)
  }   }
  if { $ans_char($jj) == "Y" || $ans_char($jj) == "y" } {   if { $ans_char($jj) == "Y" || $ans_char($jj) == "y" } {
     set y_data [lindex $weights $jj]      if {[set y_data [lindex $weights $jj]]==""} {set y_data 0}
  } elseif { $ans_char($jj) == "N" || $ans_char($jj) == "n" } {   } elseif { $ans_char($jj) == "N" || $ans_char($jj) == "n" } {
     set y_data 0      set y_data 0
  } else { ## must be in 0 .. 9   } else { ## must be in 0 .. 9
Line 1636  proc CTitemCorrelation { num classpath s Line 1648  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 1708  proc CTreportDist { num file percentage Line 1721  proc CTreportDist { num file percentage
  }   }
  set aline [gets $fileId]   set aline [gets $fileId]
     }      }
     CTputs $num "Scores #acheived\n"      CTputs $num "Scores #achieved\n"
     set scorelist ""      set scorelist ""
     set templist [array names totals *.score]      set templist [array names totals *.score]
     foreach temp $templist {lappend possiblescores [lindex [split $temp .] 0]}      foreach temp $templist {lappend possiblescores [lindex [split $temp .] 0]}
Line 1785  proc CTgradeDistribution { num classpath Line 1798  proc CTgradeDistribution { num classpath
     removeStatus $num      removeStatus $num
     displayStatus "Pondering data . . ." spinner $num      displayStatus "Pondering data . . ." spinner $num
     CTputs $num " There are $valid_cnt entries in file $filename\n"      CTputs $num " There are $valid_cnt entries in file $filename\n"
     CTputs $num "Score #acheived\n"      CTputs $num "Score #achieved\n"
     set scorelist ""      set scorelist ""
     foreach score [lsort -integer [array names total_score]] {      foreach score [lsort -integer [array names total_score]] {
  CTputs $num [format "%5d:%6d\n" $score $total_score($score)]   CTputs $num [format "%5d:%6d\n" $score $total_score($score)]
Line 1872  proc CTgradeDistributionRange { num clas Line 1885  proc CTgradeDistributionRange { num clas
  set total_score($i) 0   set total_score($i) 0
     }      }
     foreach sNum [array names studentScores] { incr total_score($studentScores($sNum)) }      foreach sNum [array names studentScores] { incr total_score($studentScores($sNum)) }
     CTputs $num "Scores #acheived\n"      CTputs $num "Scores #achieved\n"
     set scorelist ""      set scorelist ""
     foreach score [lsort -integer [array names total_score]] {      foreach score [lsort -integer [array names total_score]] {
  CTputs $num [format "%5d:%6d\n" $score $total_score($score)]   CTputs $num [format "%5d:%6d\n" $score $total_score($score)]
Line 1953  proc CToutput { num cmdnum } { Line 1966  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 2525  proc CTdisplayStudent { num window path Line 2538  proc CTdisplayStudent { num window path
   
     label $infoFrame.label -text $id      label $infoFrame.label -text $id
     pack $infoFrame.label      pack $infoFrame.label
       
     set canvas [canvas $imageFrame.canvas]      set height [image height $image]
       set width [image width $image]
       set canvas [canvas $imageFrame.canvas -height $height -width $width]
     pack $canvas      pack $canvas
     $canvas create image 1 1 -image $image -anchor nw      $canvas create image 1 1 -image $image -anchor nw
 }  }
Line 2671  proc CTdiscussForum { num file dir resul Line 2686  proc CTdiscussForum { num file dir resul
     while {![eof $fileId]} {      while {![eof $fileId]} {
  incr line_cnt   incr line_cnt
  if { ($line_cnt%20) == 0 } { updateStatusBar [expr $line_cnt/double($maxLine)] $num }   if { ($line_cnt%20) == 0 } { updateStatusBar [expr $line_cnt/double($maxLine)] $num }
  foreach {stunum capaid name email action set prob date time} [split $aline "|"] {}   foreach {stunum capaid name email action set prob date time blank} [split $aline "|"] {}
  if {$specificSet && ($specificSet == $set)} {set aline [gets $fileId];continue}   if {$specificSet && ($specificSet == $set)} {set aline [gets $fileId];continue}
  if { $action == "ViewProblem" } {   if { $action == "ViewProblem" } {
     if { [catch {incr count($set,$prob)}]} {      if { [catch {incr count($set,$prob)}]} {
Line 2718  proc CTdiscussForum { num file dir resul Line 2733  proc CTdiscussForum { num file dir resul
     close $fileId      close $fileId
     set result($num.viewers) [llength [array names ever]]      set result($num.viewers) [llength [array names ever]]
     set result($num.last) $last      set result($num.last) $last
     #IDEAS: stick into capastats      #IDEAS:
     #     : howmany viws are repeats      #     : how many views are repeats
     #     : Student Course Profile, add #ViewProblems #Posts      #     : Student Course Profile, add #ViewProblems #Posts
     #     : add some portion of these stats to analyze log files?      #     : add some portion of these stats to analyze log files?
 }  }
Line 2845  proc CTcreateReportDialog { num cmdnum } Line 2860  proc CTcreateReportDialog { num cmdnum }
  -variable gCT(summary.filename.$cmdnum) -value specified   -variable gCT(summary.filename.$cmdnum) -value specified
     set entryFrame [frame $fileFrame.entryFrame]      set entryFrame [frame $fileFrame.entryFrame]
     button $fileFrame.select -text "Select File" \      button $fileFrame.select -text "Select File" \
     -command "selectOutputFile"      -command "CTselectOutputFile $cmdnum"
     pack $fileFrame.label $entryFrame $fileFrame.select -side left      pack $fileFrame.label $entryFrame $fileFrame.select -side left
     entry $entryFrame.entry -textvariable gCT(summary.file.$cmdnum) \      entry $entryFrame.entry -textvariable gCT(summary.file.$cmdnum) \
  -xscrollcommand "$entryFrame.scroll set"   -xscrollcommand "$entryFrame.scroll set"
Line 2867  proc CTcreateReportDialog { num cmdnum } Line 2882  proc CTcreateReportDialog { num cmdnum }
 }  }
   
 ###########################################################  ###########################################################
   # CTselectOutputFile
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTselectOutputFile { num } {
       global gCT
       set gCT(summary.filename.$num) specified
       if { "" != [ set temp [tk_getSaveFile] ] } {set gCT(summary.file.$num) $temp}
   }    
   
   ###########################################################
 # CTcreateSummaryReport  # CTcreateSummaryReport
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
Line 2884  proc CTcreateSummaryReport { num cmdnum Line 2910  proc CTcreateSummaryReport { num cmdnum
     set file Sec$gCT(summary.section.$cmdnum)Set$gCT(summary.set.$cmdnum).rpt       set file Sec$gCT(summary.section.$cmdnum)Set$gCT(summary.set.$cmdnum).rpt 
  }   }
  default {   default {
     displayError "An error has occured while creating a summary \      displayError "An error has occurred while creating a summary \
     report $gCT(summary.section.$cmdnum)"      report $gCT(summary.section.$cmdnum)"
     return      return
  }   }
Line 2907  proc CTcreateSummaryReport { num cmdnum Line 2933  proc CTcreateSummaryReport { num cmdnum
   
     removeStatus $cmdnum      removeStatus $cmdnum
   
     if {!$error && "Yes" == [makeSure "Created summary file $file, would you like to see it?"]} {      if {!$error && "Yes" == [makeSure \
          "Created summary file $file, would you like to see it?"]} {
  set fileId [open [file join $gFile($num) $file] r]   set fileId [open [file join $gFile($num) $file] r]
  CTputs $cmdnum [read $fileId]   CTputs $cmdnum [read $fileId]
  CToutput $num $cmdnum    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.6  
changed lines
  Added in v.1.12


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