xowiki::formfield::enumeration instproc scores (public)
<instance of xowiki::formfield::enumeration> scores [ -r r ] \ [ -f f ] [ -rk rk ] [ -fk fk ] [ -R R ] [ -W W ]
Defined in packages/xowiki/tcl/form-field-procs.tcl
- Switches:
- -r
(defaults to"0"
) (optional)- number of answers which are true
- -f
(defaults to"0"
) (optional)- number of answers which are false
- -rk
(defaults to"0"
) (optional)- number checkmarks to a true answer
- -fk
(defaults to"0"
) (optional)- number checkmarks to a false answer
- -R
(optional)- number correct answered
- -W
(optional)- number incorrect answered
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items
Source code: # # Now calculate the scores of different scoring schemes. # if {$r > 0} { # # Certain correction schemes divide by $r. We cannot use # these schemes in such cases. # if {$f == 0} { # # No penalty for marking a wrong solution, when there is # no wrong solution. # set wi1 [expr {max((100.0/$r) * $rk, 0)}] set wi2 [expr {max((100.0/$r) * $rk, 0)}] } else { set wi1 [expr {max((100.0/$r) * $rk - (100.0/$f) * $fk, 0)}] if {$f == 1} { # # Special rule when there is just one wrong solution. # set wi2 [expr {max((100.0/$r) * $rk - min(50.0, (100.0/$f)) * $fk, 0)}] } else { set wi2 $wi1 } } set canvas [expr {max(($rk * 100.0/$r) - ($fk * 100.0/$r), 0)}] set etk [expr {100.0 * (($r*1.0+$f) /$r) * ($rk - $fk) / ($R + $W) }] } else { set wi1 0.0 set wi2 0.0 set etk 0.0 set canvas 0.0 } set s1 [expr {100.0 * $R / ($R + $W) }] set s2 [expr {100.0 * ($R - $W/2.0) / ($R + $W) }] set ggw0 [expr {100.0 * ($R - $W) / ($R + $W) }] set ggw [:ggw $R $W] return [list wi1 $wi1 wi2 $wi2 s1 $s1 s2 $s2 etk $etk ggw0 $ggw0 ggw $ggw canvas $canvas]XQL Not present: Generic, PostgreSQL, Oracle