From 40e97c8af6bdd231b4933818653c8900846e36ed Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 31 Oct 2018 07:42:04 +0100 Subject: [PATCH] Fix vote not showing for students when refreshing during a vote. Fix vote options not rendering, by adding the new wrapper for MathJax. Fix typo where non-voteable question types became voteable, and the opposite. Oops on that one. --- ajax.php | 4 ++-- amd/build/student.min.js | 2 +- amd/src/student.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ajax.php b/ajax.php index ada6953..23108c1 100755 --- a/ajax.php +++ b/ajax.php @@ -125,7 +125,7 @@ function get_question_form($session) { 'css' => $css, 'question_type' => $qtype, 'is_already_submitted' => $isalreadysubmitted, - 'voteable' => in_array($qtype, $voteable) + 'voteable' => !in_array($qtype, $voteable) ]; } @@ -452,7 +452,7 @@ function session_info($session) { case 'voting': $voteoptions = $DB->get_records('jazzquiz_votes', ['sessionid' => $session->data->id]); $options = []; - $html = '
'; + $html = '
'; $i = 0; foreach ($voteoptions as $voteoption) { $options[] = [ diff --git a/amd/build/student.min.js b/amd/build/student.min.js index bbb3d6b..e8b48ba 100644 --- a/amd/build/student.min.js +++ b/amd/build/student.min.js @@ -1 +1 @@ -"use strict";var _createClass=function(){function n(n,i){for(var e=0;e0?e.show(e.info.html(i.feedback)):u(e.info,"wait_for_instructor"),n.quiz.question.isSaving=!1,n.quiz.question.isRunning&&(n.quiz.question.isVoteRunning||(e.hide(t.box),n.quiz.question.hideTimer()))}).fail(function(){n.quiz.question.isSaving=!1})}}},{key:"saveVote",value:function(){o.post("save_vote",{vote:this.voteAnswer},function(n){"success"===n.status?u(e.info,"wait_for_instructor"):u(e.info,"you_already_voted")})}}]),i}();return{initialize:function(){new e(s).poll(2e3)}}}); \ No newline at end of file +"use strict";var _createClass=function(){function n(n,i){for(var e=0;e0?e.show(e.info.html(i.feedback)):u(e.info,"wait_for_instructor"),n.quiz.question.isSaving=!1,n.quiz.question.isRunning&&(n.quiz.question.isVoteRunning||(e.hide(t.box),n.quiz.question.hideTimer()))}).fail(function(){n.quiz.question.isSaving=!1})}}},{key:"saveVote",value:function(){o.post("save_vote",{vote:this.voteAnswer},function(n){"success"===n.status?u(e.info,"wait_for_instructor"):u(e.info,"you_already_voted")})}}]),i}();return{initialize:function(){new e(s).poll(2e3)}}}); \ No newline at end of file diff --git a/amd/src/student.js b/amd/src/student.js index ae06772..9bc3772 100755 --- a/amd/src/student.js +++ b/amd/src/student.js @@ -82,6 +82,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) { return; } Quiz.info.html(data.html); + Quiz.show(Quiz.info); const options = data.options; for (let i = 0; i < options.length; i++) { Quiz.addMathjaxElement($('#' + options[i].content_id), options[i].text);