|
23 | 23 |
|
24 | 24 | $this_section = SECTION_COURSES; |
25 | 25 | $htmlHeadXtra[] = "<script> |
26 | | -$(function(){ |
27 | | - $('#user_custom_score').click(function() { |
28 | | - $('#options').toggle(); |
| 26 | +$(function () { |
| 27 | + $('#user_custom_score').on('change', function () { |
| 28 | + if ($('#user_custom_score[type=\"checkbox\"]').prop('checked')) { |
| 29 | + $('#options').removeClass('hidden') |
| 30 | + } else { |
| 31 | + $('#options').addClass('hidden') |
| 32 | + } |
29 | 33 | }); |
30 | 34 | }); |
31 | 35 | </script>"; |
@@ -110,7 +114,7 @@ function lp_upload_quiz_main() |
110 | 114 | get_lang('UseCustomScoreForAllQuestions'), |
111 | 115 | ['id' => 'user_custom_score'] |
112 | 116 | ); |
113 | | - $form->addElement('html', '<div id="options" style="display:none">'); |
| 117 | + $form->addElement('html', '<div id="options" class="hidden">'); |
114 | 118 | $form->addElement('text', 'correct_score', get_lang('CorrectScore')); |
115 | 119 | $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore')); |
116 | 120 | $form->addElement('html', '</div>'); |
@@ -427,8 +431,10 @@ function lp_upload_quiz_action_handling() |
427 | 431 | $score, |
428 | 432 | $id |
429 | 433 | ); |
430 | | - |
431 | | - $total += (float) $score; |
| 434 | + if ($correct) { |
| 435 | + //only add the item marked as correct ( x ) |
| 436 | + $total += (float)$score; |
| 437 | + } |
432 | 438 | $id++; |
433 | 439 | } |
434 | 440 |
|
|
0 commit comments