Index: openacs-4/packages/assessment/tcl/as-merge-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-merge-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-merge-procs.tcl 16 Jun 2005 22:30:51 -0000 1.1.2.1 @@ -0,0 +1,54 @@ +ad_library { + Assessment Merge procs + @author Enrique Catalan (quio@galileo.edu) + @creation-date 2005-04-12 +} + +namespace eval as::merge { + + ad_proc -callback MergeShowUserInfo -impl as { + -user_id:required + } { + Shows assessments items + } { + set msg "Assessment items of user $user_id" + set result [list $msg] + + lappend result [list "Staff of sessions: [db_list sel_sessions { *SQL* }] "] + lappend result [list "Subject of sessions: [db_list sel_sessions2 {*SQL*}] "] + + lappend result [list "Subject of section data id: [db_list sel_sections { *SQL* }] "] + lappend result [list "Staff of section data id: [db_list sel_sections2 { *SQL* }] "] + + lappend result [list "Subject of item data id : [db_list sel_items { *SQL* }] "] + lappend result [list "Staff of item_data_id: [db_list sel_items2 { *SQL* }] "] + + return $result + } + + ad_proc -callback MergePackageUser -impl as { + -from_user_id:required + -to_user_id:required + } { + Merge the as's of two users. + The from_user_id is the user that will be + deleted and all the entries of this user + will be mapped to the to_user_id. + + } { + set msg "Merging assesment" + set result [list $msg] + ns_log Notice $msg + db_transaction { + db_dml upd_from_sessions { *SQL* } + db_dml upd_from_sessions2 { *SQL* } + db_dml upd_from_sections { *SQL* } + db_dml upd_from_sections2 { *SQL* } + db_dml upd_from_items { *SQL* } + db_dml upd_from_items2 { *SQL* } + + } + lappend result "assessment merge is done" + return $result + } +} Index: openacs-4/packages/assessment/tcl/as-merge-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-merge-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-merge-procs.xql 16 Jun 2005 22:30:51 -0000 1.1.2.1 @@ -0,0 +1,100 @@ + + + + + + select session_id + from as_sessions + where staff_id = :user_id + + + + + + select session_id + from as_sessions + where subject_id = :user_id + + + + + + select section_data_id + from as_section_data + where subject_id = :user_id + + + + + + select section_data_id + from as_section_data + where staff_id = :user_id + + + + + + select item_data_id + from as_item_data + where subject_id = :user_id + + + + + + select item_data_id + from as_item_data + where staff_id = :user_id + + + + + + update as_sessions + set staff_id = :to_user_id + where staff_id = :from_user_id + + + + + + update as_sessions + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_section_data + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_section_data + set staff_id = :to_user_id + where staff_id = :from_user_id + + + + + + update as_item_data + set subject_id = :to_user_id + where subject_id = :from_user_id + + + + + + update as_item_data + set staff_id = :to_user_id + where staff_id = :from_user_id + + + +