Index: openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl 13 Jun 2018 11:39:24 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl 13 Jun 2018 11:43:46 -0000 1.9 @@ -28,18 +28,18 @@ db_transaction { set item_answer_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [as::item::generate_unique_name]] set as_item_answer_id [content::revision::new \ - -item_id $item_answer_id \ - -content_type {as_item_sa_answers} \ - -title $title \ - -attributes [list [list answer_id $answer_id ] \ - [list data_type $data_type ] \ - [list case_sensitive_p $case_sensitive_p ] \ - [list percent_score $percent_score] \ - [list compare_by $compare_by] \ - [list regexp_text $regexp_text] \ - [list allowed_answerbox_list $allowed_answerbox_list] ] ] - # FIXME too much code repetition here - # maybe there are more efficient ways to do it (maybe using hashes to pass the values between functions) + -item_id $item_answer_id \ + -content_type {as_item_sa_answers} \ + -title $title \ + -attributes [list [list answer_id $answer_id ] \ + [list data_type $data_type ] \ + [list case_sensitive_p $case_sensitive_p ] \ + [list percent_score $percent_score] \ + [list compare_by $compare_by] \ + [list regexp_text $regexp_text] \ + [list allowed_answerbox_list $allowed_answerbox_list] ] ] + # FIXME too much code repetition here + # maybe there are more efficient ways to do it (maybe using hashes to pass the values between functions) } return $as_item_answer_id Index: openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl 13 Jun 2018 11:39:24 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl 13 Jun 2018 11:43:46 -0000 1.12 @@ -33,21 +33,21 @@ db_transaction { set item_choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name [as::item::generate_unique_name]] set as_item_choice_id [content::revision::new \ - -item_id $item_choice_id \ - -content_type {as_item_choices} \ - -title $title \ - -attributes [list [list mc_id $mc_id ] \ - [list data_type $data_type ] \ - [list numeric_value $numeric_value ] \ - [list text_value $text_value] \ - [list boolean_value $boolean_value] \ - [list content_value $content_value] \ - [list feedback_text $feedback_text] \ - [list selected_p $selected_p] \ - [list correct_answer_p $correct_answer_p] \ - [list sort_order $sort_order] \ - [list percent_score $percent_score] \ - [list fixed_position $fixed_position] ] ] + -item_id $item_choice_id \ + -content_type {as_item_choices} \ + -title $title \ + -attributes [list [list mc_id $mc_id ] \ + [list data_type $data_type ] \ + [list numeric_value $numeric_value ] \ + [list text_value $text_value] \ + [list boolean_value $boolean_value] \ + [list content_value $content_value] \ + [list feedback_text $feedback_text] \ + [list selected_p $selected_p] \ + [list correct_answer_p $correct_answer_p] \ + [list sort_order $sort_order] \ + [list percent_score $percent_score] \ + [list fixed_position $fixed_position] ] ] # FIXME too much code repetition here # maybe there are more efficient ways to do it (maybe using hashes to pass the values between functions) } @@ -66,26 +66,26 @@ } { # New revision of as_item_choice in the CR (and as_item_choices table) getting the revision_id (as_item_choice_id) db_transaction { - db_1row choice_data {} + db_1row choice_data {} set as_item_choice_id [content::revision::new \ - -item_id $item_choice_id \ - -content_type {as_item_choices} \ - -title $title \ - -attributes [list [list mc_id $mc_id ] \ - [list data_type $data_type ] \ - [list numeric_value $numeric_value ] \ - [list text_value $text_value] \ - [list boolean_value $boolean_value] \ - [list content_value $content_value] \ - [list feedback_text $feedback_text] \ - [list selected_p $selected_p] \ - [list correct_answer_p $correct_answer_p] \ - [list sort_order $sort_order] \ - [list percent_score $percent_score] \ - [list fixed_position $fixed_position] ] ] + -item_id $item_choice_id \ + -content_type {as_item_choices} \ + -title $title \ + -attributes [list [list mc_id $mc_id ] \ + [list data_type $data_type ] \ + [list numeric_value $numeric_value ] \ + [list text_value $text_value] \ + [list boolean_value $boolean_value] \ + [list content_value $content_value] \ + [list feedback_text $feedback_text] \ + [list selected_p $selected_p] \ + [list correct_answer_p $correct_answer_p] \ + [list sort_order $sort_order] \ + [list percent_score $percent_score] \ + [list fixed_position $fixed_position] ] ] } - - + + return $as_item_choice_id } @@ -104,23 +104,23 @@ # Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (as_item_choice_id) db_transaction { - db_1row choice_data {} - if {![string is true $copy_correct_answer_p]} { - set correct_answer_p "" - } - set new_choice_id [new -title $title \ - -mc_id $mc_id \ - -data_type $data_type \ - -numeric_value $numeric_value \ - -text_value $text_value \ - -boolean_value $boolean_value \ - -content_value $content_value \ - -feedback_text $feedback_text \ - -selected_p $selected_p \ - -correct_answer_p $correct_answer_p \ - -sort_order $sort_order \ - -percent_score $percent_score \ - -fixed_position $fixed_position] + db_1row choice_data {} + if {![string is true $copy_correct_answer_p]} { + set correct_answer_p "" + } + set new_choice_id [new -title $title \ + -mc_id $mc_id \ + -data_type $data_type \ + -numeric_value $numeric_value \ + -text_value $text_value \ + -boolean_value $boolean_value \ + -content_value $content_value \ + -feedback_text $feedback_text \ + -selected_p $selected_p \ + -correct_answer_p $correct_answer_p \ + -sort_order $sort_order \ + -percent_score $percent_score \ + -fixed_position $fixed_position] } return $new_choice_id