Index: openacs-4/packages/assessment/www/asm-admin/item-stats.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-stats.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-stats.tcl 14 Jun 2006 15:53:47 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-stats.tcl 7 Dec 2006 05:01:18 -0000 1.3 @@ -20,6 +20,8 @@ permission::require_permission -object_id $package_id -privilege create template::multirow create items item_id revision_id title data_type display_type stats +as::assessment::data -assessment_id $assessment_id + foreach section_id [db_list sections { select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm, cr_items ai @@ -58,6 +60,7 @@ set total_choices 0 set choices [list] + set visited_session_ids [list] db_foreach item_choices { select r.title as choice_title, c.choice_id, c.correct_answer_p, (select count(*) @@ -96,6 +99,7 @@ incr total_correct $choice_responses } } + set total_responses [db_string count_responses "select count(*) from (select distinct session_id from as_item_data, cr_revisions cr1, cr_revisions cr2 where cr1.revision_id=:revision_id and cr1.item_id=cr2.item_id and as_item_id = cr2.revision_id ) d"] if { $total_responses } { append stats "\n" @@ -104,7 +108,7 @@ array set r $choice append stats "" - if { $r(correct_answer_p) } { + if { $r(correct_answer_p) && $assessment_data(type) ne "survey"} { append stats "" } else { append stats "" @@ -114,12 +118,15 @@ if { $first_p } { append stats " \n" set first_p 0
  -[_ assessment.Total_Responses] $total_responses
+[_ assessment.Total_Responses] $total_responses
" + if {$assessment_data(type) ne "survey"} { + append stats " [_ assessment.Total_Correct] $total_correct" if { $total_correct > 0 } { append stats ", [format "%.2f" [expr double($total_correct) / $total_responses * 100]]%" } + } append stats "