Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/assessment/www/session.tcl 22 Dec 2004 20:52:17 -0000 1.26 +++ openacs-4/packages/assessment/www/session.tcl 24 Dec 2004 15:32:38 -0000 1.27 @@ -1,28 +1,17 @@ ad_page_contract { - Lists the results that an user obtains after answer an assessment. - In the results, users can view the started time and finished time - of assessment, the time spent in take the assessment, as well as - the number of attempts. The users also can view the obtained total - score, the obtained score by each item, their incorrect answers and - a right or wrong feedback. If an item isn't answered users are informed. + Show the result of a session. - @author Eduardo P�rez Ureta (eperez@it.uc3m.es) - @creation-date 2004-09-13 -} -query { - session_id:notnull -} -properties { - context:onevalue + @author timo@timohentschel.de + @date 2004-12-24 + @cvs-id $Id: +} { + session_id:integer } set context [list "[_ assessment.View_Results]"] -db_1row find_assessment { - select r.item_id as assessment_id - from as_sessions s, cr_revisions r - where s.session_id = :session_id - and r.revision_id = s.assessment_id -} +db_1row find_assessment {} # Get the assessment data as::assessment::data -assessment_id $assessment_id @@ -33,171 +22,30 @@ } set assessment_rev_id $assessment_data(assessment_rev_id) +set session_user_url [acs_community_member_url -user_id $subject_id] -if {[empty_string_p $assessment_data(show_feedback)]} { - set assessment_show_feedback "all" -} +# get start and end times +db_1row session_data {} -#get the user takes a session -db_1row session_user_id { - SELECT p.first_names, p.last_name, ss.assessment_id - FROM as_sessionsx ss, persons p - WHERE ss.subject_id = p.person_id - AND ss.session_id = :session_id -} +# get the number of attempts +set session_attempt [db_string session_attempt {}] -set assessment_url [export_vars -base "assessment" {assessment_id}] -set session_user_name "$first_names $last_name" - -#get information of assessment as subject that took it, the started time and finished time of assessment -db_1row session_data { - SELECT subject_id, creation_datetime AS session_start, - completed_datetime AS session_finish, - completed_datetime-creation_datetime AS session_time - FROM as_sessionsx ss - WHERE ss.session_id = :session_id +if {[empty_string_p $assessment_data(show_feedback)]} { + set assessment_data(show_feedback) "all" } -set session_user_url [acs_community_member_url -user_id $subject_id] -#get the number of attempts -set session_attempt [db_string session_attempt { - SELECT COUNT(*) - FROM as_sessionsx ss - WHERE ss.subject_id = :subject_id - AND ss.assessment_id = :assessment_rev_id -}] +# show_feedback: none, all, incorrect, correct -set assessment_score 100 ;# FIXME -#get the number of items of an assessment -set assessment_items [db_string assessment_items { - SELECT COUNT(*) - FROM as_sectionsx s, as_assessmentsx a, as_assessment_section_map asm, - as_itemsx i, as_item_section_map ism - WHERE a.assessment_id = asm.assessment_id - AND s.section_id = asm.section_id - AND i.as_item_id = ism.as_item_id - AND s.section_id = ism.section_id - AND a.assessment_id = :assessment_rev_id -}] -#set maximum score by each item -set itemmaxscore [expr $assessment_score/$assessment_items] ;# FIXME total_points/items_number - -set session_score 0 -db_multirow -extend [list choice_html score maxscore notanswered item_correct presentation_type] items query_all_items {} { - #reset variables - set rb__display_id {} - unset rb__display_id - set tb__display_id {} - unset tb__display_id - set ta__display_id {} - unset ta__display_id - set mc_id [as::item_rels::get_target -item_rev_id $as_item_id -type as_item_type_rel] - set item_display_id [as::item_rels::get_target -item_rev_id $as_item_id -type as_item_display_rel] - #set items_as_item_id [db_string items_items_as_item_id "SELECT item_id FROM cr_revisions WHERE revision_id = :as_item_id"] - set items_as_item_id [db_string items_items_as_item_id "SELECT as_itemsx.as_item_id FROM as_itemsx WHERE as_itemsx.item_id IN (select item_id from cr_revisions where revision_id=:as_item_id)"] - db_0or1row as_item_display_rbx "SELECT as_item_display_id AS rb__display_id FROM as_item_display_rb WHERE as_item_display_id=:item_display_id" - db_0or1row as_item_display_tbx "SELECT as_item_display_id AS tb__display_id FROM as_item_display_tb WHERE as_item_display_id=:item_display_id" - db_0or1row as_item_display_tax "SELECT as_item_display_id AS ta__display_id FROM as_item_display_ta WHERE as_item_display_id=:item_display_id" - set presentation_type "checkbox" ;# DEFAULT - #get the presentation type - if {[info exists rb__display_id]} {set presentation_type "radio"} - if {[info exists tb__display_id]} {set presentation_type "fitb"} - if {[info exists ta__display_id]} {set presentation_type "textarea"} - - set notanswered 1 - set maxscore $itemmaxscore - set score 0 - set item_correct 1 - set choice_html "
$correct_answer | $choice_answer |
$correct_answer | $choice_answer [ad_quotehtml $choice_title] |
$correct_answer | $choice_answer [ad_quotehtml $choice_title] |
$correct_answer | $choice_answer [ad_quotehtml $choice_title] |