Index: openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml,v
diff -u -r1.2.2.26 -r1.2.2.27
--- openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 25 Apr 2020 21:35:12 -0000 1.2.2.26
+++ openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 28 Apr 2020 19:47:20 -0000 1.2.2.27
@@ -4,6 +4,8 @@
Beispiel
Bewertungsschema
Bewertung
+ Note
+ Gesamtbewertung
Zuf�llige Reihenfolge
Tage
Tag
Index: openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml,v
diff -u -r1.2.2.24 -r1.2.2.25
--- openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 25 Apr 2020 21:35:12 -0000 1.2.2.24
+++ openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 28 Apr 2020 19:47:20 -0000 1.2.2.25
@@ -4,6 +4,8 @@
Exercise
Grading Scheme
Score
+ Grade
+ Total Score
Shuffle
Days
Day
Index: openacs-4/packages/xowf/lib/inclass-exam.wf
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/inclass-exam.wf,v
diff -u -r1.1.2.27 -r1.1.2.28
--- openacs-4/packages/xowf/lib/inclass-exam.wf 28 Apr 2020 16:34:08 -0000 1.1.2.27
+++ openacs-4/packages/xowf/lib/inclass-exam.wf 28 Apr 2020 19:47:20 -0000 1.1.2.28
@@ -354,6 +354,8 @@
#
:proc www-print-answer-table {} {
set HTML ""
+ set withAnswerColumns [${:package_id} query_parameter with_answers:boolean 0]
+
set wf [xowf::test_item::answer_manager get_answer_wf [self]]
if {$wf ne ""} {
#set form_info [::xowf::test_item::question_manager combined_question_form -with_numbers [self]]
@@ -368,6 +370,7 @@
-package_id ${:package_id} \
-items $items2 \
-state * \
+ -with_answers $withAnswerColumns \
[self]]
$items2 destroy
}
Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v
diff -u -r1.7.2.55 -r1.7.2.56
--- openacs-4/packages/xowf/tcl/test-item-procs.tcl 28 Apr 2020 16:39:03 -0000 1.7.2.55
+++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 28 Apr 2020 19:47:20 -0000 1.7.2.56
@@ -1597,6 +1597,7 @@
-package_id:integer
-items:object,required
{-view_all_method print-answers}
+ {-with_answers:boolean true}
{-state done}
wf:object
} {
@@ -1605,29 +1606,46 @@
set answer_form_field_objs [:answer_form_field_objs -wf $wf $form_info]
set autograde [dict get $form_info autograde]
+ set percentage_to_grade {50.0 60.0 70.0 80.0} ;# WI
+ if {$autograde && [llength $answer_form_field_objs] > 10} {
+ set with_answers 0
+ }
+
set form_field_objs {}
lappend form_field_objs \
[$wf create_raw_form_field \
-name _online-exam-userName \
-spec text,label=#xowf.participant#]
- #
- # Create for every answer field a matching grading field
- #
- set ff_dict {}
- foreach answer_field_obj $answer_form_field_objs {
- #ns_log notice "LABEL [$answer_field_obj name] <[$answer_field_obj label]>"
- $answer_field_obj label [string trimright [$answer_field_obj name] _]
- $answer_field_obj mixin ::xowf::test_item::td_pretty_value
+ if {$with_answers} {
+ #
+ # Create for every answer field a matching grading field
+ #
+ set ff_dict {}
+ foreach answer_field_obj $answer_form_field_objs {
+ #ns_log notice "LABEL [$answer_field_obj name] <[$answer_field_obj label]>"
+ $answer_field_obj label [string trimright [$answer_field_obj name] _]
+ $answer_field_obj mixin ::xowf::test_item::td_pretty_value
- set grading_field_obj [$wf create_raw_form_field \
- -name [$answer_field_obj name].score \
- -spec number,label=#xowf.Grading-Score#]
+ set grading_field_obj [$wf create_raw_form_field \
+ -name [$answer_field_obj name].score \
+ -spec number,label=#xowf.Grading-Score#]
+ lappend form_field_objs \
+ $answer_field_obj \
+ $grading_field_obj
+ dict set ff_dict [$answer_field_obj name] $answer_field_obj
+ dict set ff_dict [$grading_field_obj name] $grading_field_obj
+ }
+ }
+
+ if {$autograde} {
lappend form_field_objs \
- $answer_field_obj \
- $grading_field_obj
- dict set ff_dict [$answer_field_obj name] $answer_field_obj
- dict set ff_dict [$grading_field_obj name] $grading_field_obj
+ [$wf create_raw_form_field \
+ -name _online-exam-total-score \
+ -spec number,label=#xowf.Total-Score#] \
+ [$wf create_raw_form_field \
+ -name _online-exam-grade \
+ -spec number,label=#xowf.Grade#]
}
lappend form_field_objs \
@@ -1686,6 +1704,8 @@
}
}
+ set total_score 0
+ set total_points 0
foreach ff_obj $answer_form_field_objs {
$ff_obj object $p
set property [$ff_obj name]
@@ -1696,6 +1716,13 @@
#ns_log notice "[$p creation_user] [$ff_obj name] [$p property $property] -> [$ff_obj set evaluated_answer_result]"
if {[$ff_obj exists grading_score]} {
set r [$ff_obj set grading_score]
+ #
+ # Add exericse score weighted to the total score.
+ #
+ if {[$ff_obj exists test_item_minutes]} {
+ set total_score [expr {$total_score + ([$ff_obj set test_item_minutes] * [$ff_obj set grading_score])}]
+ set total_points [expr {$total_points + [$ff_obj set test_item_minutes]}]
+ }
#ns_log notice "==== [$ff_obj name] grading_score => $r"
} else {
set r [expr {[$ff_obj set evaluated_answer_result] eq "correct" ? 100.0 : 0.0}]*
@@ -1707,6 +1734,26 @@
set duration [:get_duration [$p get_revision_sets]]
$p set_property -new 1 _online-exam-seconds \
[expr {[dict get $duration toClock] - [dict get $duration fromClock]}]
+
+ if {$autograde && $total_points > 0} {
+ set final_score [expr {$total_score/$total_points}]
+ $p set_property -new 1 _online-exam-total-score $final_score
+
+ set percentage [format %.0f $final_score]
+ set grade 1
+ set gradePos 0
+ foreach boundary $percentage_to_grade {
+ #ns_log notice "compare $percentage < $boundary"
+ if {$percentage < $boundary} {
+ set grade [expr {5-$gradePos}]
+ #ns_log notice "setting grade to $grade"
+ break
+ }
+ incr gradePos
+ }
+ dict incr grade_count $grade
+ $p set_property -new 1 _online-exam-grade $grade
+ }
}
if {$state eq "done"} {
@@ -1731,6 +1778,27 @@
-return_url_att local_return_url \
]
$table_widget destroy
+
+ if {$autograde} {
+ set gradingTable {
}
+ append gradingTable \
+ "#xowf.Grade# | # | " \
+ "\n"
+ set nrGrades 0
+ foreach v [dict values $grade_count] { incr nrGrades $v}
+ foreach k [lsort [dict keys $grade_count]] {
+ set count [dict get $grade_count $k]
+ set countPercentage [expr {$count*100.0/$nrGrades}]
+ append gradingTable \
+ \
+ [subst {$k | $count | }] \
+ [subst { | \n
+ }
+ append gradingTable "
\n"
+ append HTML $gradingTable
+ }
return $HTML
}
@@ -1921,7 +1989,7 @@
#
set nowMs [clock milliseconds]
set nowIsoTime [clock format [expr {$nowMs/1000}] -format "%Y-%m-%dT%H:%M:%S"].[format %.3d [expr {$nowMs % 1000}]]
-
+
template::add_body_script -script [subst {
var countdown_target_date = new Date('$target_time').getTime();
var countdown_days, countdown_hours, countdown_minutes, countdown_seconds;