Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.32 -r1.33 --- openacs-4/packages/assessment/assessment.info 28 Feb 2005 18:26:41 -0000 1.32 +++ openacs-4/packages/assessment/assessment.info 3 Mar 2005 22:46:41 -0000 1.33 @@ -7,17 +7,17 @@ f f - + Eduardo Perez Ureta - Assessment package that will replace the survey, - quizz, complex survey, poll and other data collection packages + Assessment package that will replace the survey, + quizz, complex survey, poll and other data collection packages that OpenACS currently supports. - 2005-02-11 + 2005-03-03 E-LANE Create assessments and evalueate. 0 - + @@ -28,7 +28,7 @@ - + Index: openacs-4/packages/assessment/tcl/as-apm-action-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-apm-action-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-apm-action-procs.tcl 14 Feb 2005 17:20:34 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-apm-action-procs.tcl 3 Mar 2005 22:46:41 -0000 1.4 @@ -21,5 +21,26 @@ } { } { db_exec_plsql after_upgrade {} + } +ad_proc -public as::actions::update_checks_after_upgrade { + +} { +} { + set checks [db_list_of_lists get_all_checks {}] + foreach check $checks { + set inter_item_check_id [lindex $check 0] + set check_sql [lindex $check 1] + set cond_list [split $check_sql "="] + set item_id [lindex [split [lindex $cond_list 2] " "] 0] + set condition [lindex [split [lindex $cond_list 1] " "] 0] + + set append_sql " and id.item_data_id = (select max(item_data_id) from as_item_data where as_item_id=$item_id and session_id=:session_id)" + append check_sql $append_sql + + db_dml update_checks {} + + } +} + Index: openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 28 Feb 2005 22:31:58 -0000 1.6 +++ openacs-4/packages/assessment/tcl/as-checks-procs-oracle.xql 3 Mar 2005 22:46:41 -0000 1.7 @@ -18,53 +18,6 @@ - - - - declare begin - :1 := as_inter_item_check.new ( - inter_item_check_id => null, - name => :name, - action_p => :action_p, - section_id_from => :section_id_from, - section_id_to => :section_id_to, - check_sql => :check_sql, - description => :description, - postcheck_p => :postcheck_p, - item_id => null, - assessment_id => :assessment_id, - creation_user => :user_id, - context_id => null, - object_type => 'as_inter_item_check', - creation_date => null - ); - end; - - - - - declare begin - :1 := as_inter_item_check.new ( - inter_item_check_id => null, - name => :name, - action_p => :action_p, - section_id_from => :section_id_from, - section_id_to => :section_id_to, - check_sql => :check_sql, - description => :description, - postcheck_p => :postcheck_p, - item_id => null, - assessment_id => :assessment_id, - creation_user => :user_id, - context_id => null, - object_type => 'as_inter_item_check', - creation_date => null - ); - end; - - - - begin Index: openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 28 Feb 2005 23:09:05 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-checks-procs-postgresql.xql 3 Mar 2005 22:46:41 -0000 1.12 @@ -17,38 +17,6 @@ - - - select inter_item_check_id,action_p,check_sql,postcheck_p,section_id_from,section_id_to,item_id,name,description,assessment_id from as_inter_item_checks where section_id_from=:section_id and assessment_id=:assessment_id - - - - - - - - select inter_item_check_id,action_p,check_sql,postcheck_p,section_id_from,section_id_to,item_id,name,description,assessment_id from as_inter_item_checks where section_id_from=:section_id and assessment_id=:assessment_id - - - - - - - - - - select as_inter_item_check__new (null,:action_p,:section_id_from,null,:check_sql,:name,:description,:postcheck_p,null,:user_id,null,:assessment_id) - - - - - - - select as_inter_item_check__new (null,:action_p,:section_id_from,null,:check_sql,:name,:description,:postcheck_p,null,:user_id,null,:assessment_id) - - - - select as_inter_item_check__delete (:check_id) Index: openacs-4/packages/assessment/tcl/as-checks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/assessment/tcl/as-checks-procs.tcl 2 Mar 2005 20:59:01 -0000 1.23 +++ openacs-4/packages/assessment/tcl/as-checks-procs.tcl 3 Mar 2005 22:46:41 -0000 1.24 @@ -230,12 +230,24 @@ if {[exists_and_not_null choice_id]} { set $varname "$choice_id" } else { - append $varname $boolean_answer - append $varname $numeric_answer - append $varname $integer_answer - append $varname $text_answer - append $varname $clob_answer - append $varname $content_answer + if { [info exists boolean_answer] } { + append $varname $boolean_answer + } + if { [info exists numeric_answer] } { + append $varname $numeric_answer + } + if { [info exists integer_answer] } { + append $varname $integer_answer + } + if { [info exists text_answer] } { + append $varname $text_answer + } + if { [info exists clob_answer] } { + append $varname $clob_answer + } + if { [info exists content_answer] } { + append $varname $content_answer + } } } else { set $varname $value @@ -287,12 +299,25 @@ if {[exists_and_not_null choice_id]} { set $varname "$choice_id" } else { - append $varname $boolean_answer - append $varname $numeric_answer - append $varname $integer_answer - append $varname $text_answer - append $varname $clob_answer - append $varname $content_answer + if { [info exists boolean_answer] } { + append $varname $boolean_answer + } + if { [info exists numeric_answer] } { + append $varname $numeric_answer + } + if { [info exists integer_answer] } { + append $varname $integer_answer + } + if { [info exists text_answer] } { + append $varname $text_answer + } + if { [info exists clob_answer] } { + append $varname $clob_answer + } + if { [info exists content_answer] } { + append $varname $content_answer + } + } } else { set $varname $value @@ -480,42 +505,9 @@ set user_id [ad_conn user_id] set checks [db_list_of_lists get_checks {}] foreach check $checks { - - set inter_item_check_id [lindex $check 0] - set action_p [lindex $check 1] - set check_sql [lindex $check 2] - set postcheck_p [lindex $check 3] - set section_id_from $new_section_id - set section_id_to [lindex $check 5] - set item_id [lindex $check 6] - set name [lindex $check 7] - set description [lindex $check 8] - - set insert_p [db_exec_plsql copy_check {}] - - # copy action map - - if { $action_p == "t"} { - set exist_p [db_0or1row get_action_map { }] - if {$exist_p == 1} { - db_dml insert_action_map {} - # copy parameters - - set parameters [db_list_of_lists parameters { }] - - foreach parameter $parameters { - set parameter_id [lindex $parameter 0] - set value [lindex $parameter 1] - set item_id [lindex $parameter 2] - - db_dml copy_parameter {} - } - - } - - } - + set inter_item_check_id [lindex $check 0] + db_dml update_checks {} } #update other checks update_checks -section_id $section_id -new_section_id $new_section_id @@ -578,36 +570,13 @@ set cond_list [split [lindex $check 1] "="] set item_id [lindex [split [lindex $cond_list 2] " "] 0] set condition [lindex [split [lindex $cond_list 1] " "] 0] - + if {$item_id == $as_item_id} { set inter_item_check_id [lindex $check 0] - set action_p [lindex $check 6] - set postcheck_p [lindex $check 8] - set section_id_from $section_id - set section_id_to [lindex $check 3] - set item_id [lindex $check 7] - set name [lindex $check 4] set check_sql [as::assessment::check::get_sql -item_id $new_item_id -condition $condition] - set description [lindex $check 5] - set insert_p [db_exec_plsql copy_check {}] - if { $action_p == "t"} { - set exist_p [db_0or1row get_action_map { }] - if {$exist_p == 1} { - - db_dml insert_action_map {} - # copy parameters - set parameters [db_list_of_lists parameters { }] - foreach parameter $parameters { - set parameter_id [lindex $parameter 0] - set value [lindex $parameter 1] - set item_id [lindex $parameter 2] - - db_dml copy_parameter {} - } - - } - } + db_dml update_checks {} + } } } Index: openacs-4/packages/assessment/tcl/as-checks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-checks-procs.xql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/assessment/tcl/as-checks-procs.xql 2 Mar 2005 22:35:28 -0000 1.18 +++ openacs-4/packages/assessment/tcl/as-checks-procs.xql 3 Mar 2005 22:46:41 -0000 1.19 @@ -293,61 +293,21 @@ - - - select action_id,order_by,user_message,action_perform from as_action_map where inter_item_check_id=:inter_item_check_id - - - - - select action_id,order_by,user_message,action_perform from as_action_map where inter_item_check_id=:inter_item_check_id - - - - - insert into as_action_map (inter_item_check_id,action_id,order_by,user_message,action_perform) values - (:insert_p,:action_id,:order_by,:user_message,:action_perform) + + + update as_inter_item_checks set section_id_from=:new_section_id where inter_item_check_id=:inter_item_check_id - + - insert into as_action_map (inter_item_check_id,action_id,order_by,user_message,action_perform) values - (:insert_p,:action_id,:order_by,:user_message,:action_perform) + update as_inter_item_checks set check_sql=:check_sql where inter_item_check_id=:inter_item_check_id - - - select parameter_id,value,item_id from as_param_map - where inter_item_check_id=:inter_item_check_id - - - - - - select parameter_id,value,item_id from as_param_map - where inter_item_check_id=:inter_item_check_id - - - - - - - insert into as_param_map (parameter_id,value,item_id,inter_item_check_id) values (:parameter_id,:value,:item_id,:insert_p) - - - - - - insert into as_param_map (parameter_id,value,item_id,inter_item_check_id) values (:parameter_id,:value,:item_id,:insert_p) - - - - select inter_item_check_id from as_inter_item_checks where section_id_to =:section_id Index: openacs-4/packages/assessment/tcl/as-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-install-procs.tcl,v diff -u -r1.25 -r1.26 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 21 Feb 2005 14:32:56 -0000 1.25 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 3 Mar 2005 22:46:41 -0000 1.26 @@ -346,6 +346,9 @@ content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {keywords} -datatype {string} -pretty_name {Keywords} -column_spec {varchar(4000)} } } + 0.10d9 0.10d10 { + as::actions::update_checks_after_upgrade + } } } Index: openacs-4/packages/assessment/www/finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/finish.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/finish.tcl 2 Mar 2005 22:37:05 -0000 1.3 +++ openacs-4/packages/assessment/www/finish.tcl 3 Mar 2005 22:46:41 -0000 1.4 @@ -13,10 +13,15 @@ page_title:onevalue } +set user_id [ad_conn user_id] +if { $user_id != 0} { + db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id} +} + if {[info exists return_url]} { if { $return_url != ""} { - ad_returnredirect "$return_url" + ad_returnredirect "$return_url" } } set page_title "[_ assessment.Response_Submitted]"