Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/assessment/www/session.tcl 5 Nov 2004 00:43:23 -0000 1.16 +++ openacs-4/packages/assessment/www/session.tcl 17 Nov 2004 17:16:08 -0000 1.17 @@ -1,4 +1,12 @@ 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. + @author Eduardo P�rez Ureta (eperez@it.uc3m.es) @creation-date 2004-09-13 } -query { @@ -10,18 +18,24 @@ set context [list "[_ assessment.View_Results]"] set assessment_name [db_string assessment_name {SELECT as_assessmentsx.title FROM as_assessmentsx INNER JOIN as_sessionsx ON as_assessmentsx.assessment_id = as_sessionsx.assessment_id WHERE as_sessionsx.session_id=:session_id}] +#get the user takes a session db_1row session_user_id {SELECT persons.first_names, persons.last_name, assessment_id FROM as_sessionsx INNER JOIN persons ON as_sessionsx.subject_id = persons.person_id WHERE as_sessionsx.session_id=:session_id} 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 WHERE as_sessionsx.session_id = :session_id} 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 WHERE as_sessionsx.subject_id = :subject_id AND as_sessionsx.assessment_id=:assessment_id}] 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 INNER JOIN (as_assessmentsx INNER JOIN as_assessment_section_map ON as_assessmentsx.assessment_id=as_assessment_section_map.assessment_id) ON as_sectionsx.section_id=as_assessment_section_map.section_id) INNER JOIN (as_itemsx INNER JOIN as_item_section_map ON as_itemsx.as_item_id=as_item_section_map.as_item_id) ON as_sectionsx.section_id=as_item_section_map.section_id WHERE as_assessmentsx.assessment_id = :assessment_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 as_item_display_rbx__item_id {} unset as_item_display_rbx__item_id set as_item_display_tbx__item_id {} @@ -37,6 +51,7 @@ db_0or1row as_item_display_tbx "SELECT item_id AS as_item_display_tbx__item_id FROM as_item_display_tbx WHERE item_id=:item_display_id" db_0or1row as_item_display_tax "SELECT item_id AS as_item_display_tax__item_id FROM as_item_display_tax WHERE item_id=:item_display_id" set presentation_type "checkbox" ;# DEFAULT + #get the presentation type if {[info exists as_item_display_rbx__item_id]} {set presentation_type "radio"} if {[info exists as_item_display_tbx__item_id]} {set presentation_type "fitb"} if {[info exists as_item_display_tax__item_id]} {set presentation_type "textarea"} @@ -47,26 +62,34 @@ set item_correct 1 set choice_html "
$correct_answer | $choice_answer |
$correct_answer | $choice_answer |
$correct_answer | $choice_answer [ad_quotehtml $choice_title] |
$correct_answer | $choice_answer [ad_quotehtml $choice_title] |