Diff for /capa/capa51/GUITools/capastats.tcl between versions 1.1.1.1 and 1.2

version 1.1.1.1, 1999/09/28 21:25:37 version 1.2, 1999/10/15 14:29:34
Line 44  proc runCapaTools { classDirConfigFile } Line 44  proc runCapaTools { classDirConfigFile }
     $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 672  proc CTgraphAnalyzeScorer { num } { Line 673  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)
       CToutput $num $cmdnum
       removeStatus $cmdnum
       unset gCT(cmd.$cmdnum)
   }
   
   ###########################################################
 # CTquit  # CTquit
 ###########################################################  ###########################################################
 ###########################################################  ###########################################################
Line 2605  proc CTcreateSubset { num cmdnum day set Line 2623  proc CTcreateSubset { num cmdnum day set
     catch {unset answerArray}      catch {unset answerArray}
     catch {unset exist}      catch {unset exist}
 }  }
   
   ###########################################################
   # CTdiscussForum
   ###########################################################
   ###########################################################
   ###########################################################
   proc CTdiscussForum { num file dir } {
       global gCT gFile
   
       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 { $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 "Generating Output" $num
       updateStatusBar 0 $num
       for {set i 1} { $i <= $last } { incr i } {
    updateStatusBar [expr $i/$last] $num 
    #if { [catch {set max($i)}]} { break }
    set total($i) 0
    for {set j 1} { $j < $max($i) } { incr j } {
       set message ""
       if {[catch {set message "Set [format %2d $i] Problem [format %3d $j] [format %3d $posts($i,$j)] reponses, viewed [format %4d $count($i,$j)] times, "} ]} { continue } 
       incr total($i) $count($i,$j)
       if { [catch { set ratio [expr $count($i,$j)/double($posts($i,$j))]} error]} {
    append message "ratio [format %5s [format %3.1f 0]]"
       } else {
    append message "ratio [format %5s [format %3.1f $ratio]]"
       }
       append message " from [format %3d [llength [array names nameprob $i,$j,*]]] viewers\n"
       CTputs $num $message
    }
    CTputs $num "Total views for set $i: $total($i)\n"
       }
       
       for {set i 1} { 1 } { incr i } {
    if { [catch {set max($i)}]} { break }
    CTputs $num "For set $i Num viewers:[llength [array names names $i,*]] causing $total($i) views.\n"
       }
       close $fileId
       CTputs $num "Total # of unique visitors [llength [array names ever]]\n"
       #IDEAS: stick into capastats
       #     : howmany viws are repeats
       #     : Student Course Profile, add #ViewProblems #Posts
       #     : add some portion of these stats to analyze log files?
   }
   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.2


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