Index: openacs-4/packages/assessment/lib/section-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/assessment/lib/section-items.tcl 11 Mar 2005 18:54:12 -0000 1.7 +++ openacs-4/packages/assessment/lib/section-items.tcl 13 Apr 2005 10:48:29 -0000 1.8 @@ -3,25 +3,25 @@ } db_multirow -extend { checks_related presentation_type html mc_type choice_orientation } items section_items {} { - set presentation_type [as::item_form::add_item_to_form -name admin_section -section_id $section_id -item_id $as_item_id] + set presentation_type [as::item_form::add_item_to_form -name admin_section -section_id $section_id -item_id $as_item_id -random_p f] if {$presentation_type == "fitb"} { regsub -all -line -nocase -- { - - - select max(t.as_item_type_id) as as_item_type_id - from as_item_type_mc t, cr_revisions c, as_item_rels r - where t.as_item_type_id = r.target_rev_id - and r.item_rev_id = :as_item_id - and r.rel_type = 'as_item_type_rel' - and c.revision_id = t.as_item_type_id - group by c.title, t.increasing_p, t.allow_negative_p, - t.num_correct_answers, t.num_answers - - - - - - - - select d.choice_orientation - from as_item_rels r, as_item_display_$presentation_type d - where r.item_rev_id = :as_item_id - and r.rel_type = 'as_item_display_rel' - and r.target_rev_id = d.as_item_display_id - - - - - - - select check_sql from as_inter_item_checks where assessment_id=:assessment_id and section_id_from=:section_id - - - - - Index: openacs-4/packages/assessment/tcl/as-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-item-procs.tcl 19 Jan 2005 16:49:14 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-item-procs.tcl 13 Apr 2005 10:48:29 -0000 1.11 @@ -203,3 +203,43 @@ } { db_dml copy_types {} } + +ad_proc -private as::item::mc_type { + -as_item_id:required +} { + Return the type to determine if this is a multiple choice question + + Allow caching of the choice_orientation as it is unlikely to change. +} { + return [util_memoize [list as::item::mc_type_not_cached -as_item_id $as_item_id]] +} + +ad_proc -private as::item::mc_type_not_cached { + -as_item_id:required +} { + Return the type to determine if this is a multiple choice question + +} { + return [db_string item_type_id {} -default "nmc"] +} + +ad_proc -private as::item::get_choice_orientation { + -as_item_id:required + -presentation_type:required +} { + Return the orientation for choices. + + Allow caching of the choice_orientation as it is unlikely to change. +} { + return [util_memoize [list as::item::get_choice_orientation_not_cached -as_item_id $as_item_id -presentation_type $presentation_type]] +} + +ad_proc -private as::item::get_choice_orientation_not_cached { + -as_item_id:required + -presentation_type:required +} { + Return the orientation for choices + +} { + return [db_string get_choice_orientation ""] +} \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-item-procs.xql 14 Jan 2005 13:13:37 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-item-procs.xql 13 Apr 2005 10:48:29 -0000 1.4 @@ -72,4 +72,32 @@ + + + + select max(t.as_item_type_id) as as_item_type_id + from as_item_type_mc t, cr_revisions c, as_item_rels r + where t.as_item_type_id = r.target_rev_id + and r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_type_rel' + and c.revision_id = t.as_item_type_id + group by c.title, t.increasing_p, t.allow_negative_p, + t.num_correct_answers, t.num_answers + + + + + + + + select d.choice_orientation + from as_item_rels r, as_item_display_$presentation_type d + where r.item_rev_id = :as_item_id + and r.rel_type = 'as_item_display_rel' + and r.target_rev_id = d.as_item_display_id + + + + + Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 13 Apr 2005 04:23:48 -0000 1.22 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 13 Apr 2005 10:48:29 -0000 1.23 @@ -361,3 +361,25 @@ calculate -section_id $section_id -assessment_id $assessment_id -session_id $session_id } } + + +ad_proc -private as::section::checks_list { + -assessment_id:required + -section_id:required +} { + Return a list of checks for the section within the assessment + + Allow caching of the choice_orientation as it is unlikely to change. +} { + return [util_memoize [list as::section::checks_list_not_cached -assessment_id $assessment_id -section_id $section_id]] +} + +ad_proc -private as::section::checks_list_not_cached { + -assessment_id:required + -section_id:required +} { + Return a list of checks for the section within the assessment + +} { + return [db_list_of_lists checks_related { } ] +} \ No newline at end of file Index: openacs-4/packages/assessment/tcl/as-section-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-section-procs.xql 21 Feb 2005 14:32:56 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-section-procs.xql 13 Apr 2005 10:48:29 -0000 1.12 @@ -104,5 +104,14 @@ + + + + select check_sql from as_inter_item_checks where assessment_id=:assessment_id and section_id_from=:section_id + + + + +