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.11 -r1.12 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 14 Jan 2005 13:13:37 -0000 1.11 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 18 Jan 2005 12:42:37 -0000 1.12 @@ -272,3 +272,22 @@ return $item_list } + +ad_proc -public as::section::calculate { + -section_id:required + -assessment_id:required + -session_id:required +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-01-14 + + Award points to this section if all items are filled out in this section +} { + if {![db_0or1row max_section_points {}]} { + return + } + + db_1row sum_of_item_points {} + set section_points [expr round($section_max_points * $item_points / $item_max_points)] + db_dml update_section_points {} +}