Index: openacs-4/packages/assessment/tcl/as-qti-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-qti-procs.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/assessment/tcl/as-qti-procs.tcl 14 Feb 2005 08:43:14 -0000 1.24 +++ openacs-4/packages/assessment/tcl/as-qti-procs.tcl 15 Feb 2005 18:07:50 -0000 1.25 @@ -84,6 +84,18 @@ set as_assessments__ip_mask "" set as_assessments__show_feedback "none" set as_assessments__section_navigation "default path" + + set itemfeedbacknodes [$root selectNodes {/questestinterop/assessment/section/item/itemfeedback}] + if { [llength $itemfeedbacknodes] >0} { + as_assessments__show_feedback "all" + } + set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] + set as_assessments__survey_p {f} + if { [llength $resprocessNodes] == 0 } { + set as_assessments__survey_p {t} + #if it's a survey don't show feedback + set as_assessments__show_feedback "none" + } if {[llength $qtimetadataNodes] > 0} { #nodes qtimetadatafield @@ -137,16 +149,8 @@ } } - } - - set show_feedback "all" - set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] - set as_assessments__survey_p {f} - if { [llength $resprocessNodes] == 0 } { - set as_assessments__survey_p {t} - #if it's a survey don't show feedback - set show_feedback "none" } + # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id) set as_assessments__assessment_id [as::assessment::new \ -title $as_assessments__title \ @@ -165,7 +169,7 @@ -wait_between_tries $as_assessments__wait_between_tries \ -time_for_response $as_assessments__duration \ -ip_mask $as_assessments__ip_mask \ - -show_feedback $show_feedback \ + -show_feedback $as_assessments__show_feedback \ -section_navigation $as_assessments__section_navigation \ -survey_p $as_assessments__survey_p ] @@ -650,6 +654,7 @@ # (each choice) set response_labelNodes [$presentation selectNodes {.//response_label}] foreach response_label $response_labelNodes { + set selected_p f set as_item_choices__ident [$response_label getAttribute {ident}] set mattextNodes [$response_label selectNodes {material/mattext/text()}] set as_item_choices__choice_text [db_null] @@ -675,7 +680,14 @@ set as_item_choices__score($as_item_choices__ident) 0 } # insert as_item_choice - as::item_choice::new -mc_id $as_item_type_id -title $as_item_choices__choice_text -sort_order $sort_order -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) -percent_score $as_item_choices__score($as_item_choices__ident) -content_value $as_item_choices__content_value + as::item_choice::new \ + -mc_id $as_item_type_id \ + -title $as_item_choices__choice_text \ + -sort_order $sort_order \ + -selected_p $selected_p \ + -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) \ + -percent_score $as_item_choices__score($as_item_choices__ident) \ + -content_value $as_item_choices__content_value # order of the item_choices incr sort_order } Index: openacs-4/packages/assessment/www/asm-admin/export/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.vuh,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/export/index.vuh 14 Feb 2005 12:24:07 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/export/index.vuh 15 Feb 2005 18:07:50 -0000 1.5 @@ -598,6 +598,9 @@ $displayfeedback setAttribute linkrefid $linkrefid $respcondition appendChild $displayfeedback + set num_answers_correct "" + db_0or1row num_answers_correct {} + db_foreach query_all_choices {} { set i 0 # [info exists tb__display_id] because for fib item choice_correct_answer_p is null @@ -639,7 +642,9 @@ # in fib items choice_percent_score column is null if {[empty_string_p $choice_percent_score]} { set choice_percent_score 1 - } + } else { + set choice_percent_score [expr round (($num_answers_correct * $choice_percent_score * 1.0) / 100)] + } set text [$doc createCDATASection $choice_percent_score] $setvar appendChild $text } Index: openacs-4/packages/assessment/www/asm-admin/export/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/www/asm-admin/export/index.xql 14 Feb 2005 12:24:07 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/export/index.xql 15 Feb 2005 18:07:50 -0000 1.5 @@ -121,4 +121,16 @@ and ir.rel_type = 'as_item_type_rel' + + + + SELECT count(aic.correct_answer_p) as num_answers_correct + FROM cr_revisions r, as_item_choicesx aic + left outer join cr_revisions r2 on (r2.revision_id = aic.content_value) + left outer join cr_items i on (i.item_id = r2.item_id) + WHERE aic.mc_id= :mc_id + and r.revision_id = aic.choice_id + and aic.correct_answer_p = 't' + +