Skip to content

Commit 84863e8

Browse files
author
Hans Georg Schaathun
committed
Merge branch 'release/1.1'
2 parents be494fc + 7387972 commit 84863e8

26 files changed

+280
-88
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-18.04
7+
runs-on: ubuntu-20.04
88

99
services:
1010
postgres:
@@ -73,7 +73,7 @@ jobs:
7373

7474
- name: Moodle Code Checker
7575
if: ${{ always() }}
76-
run: moodle-plugin-ci codechecker --max-warnings 0
76+
run: moodle-plugin-ci codechecker
7777

7878
- name: Moodle PHPDoc Checker
7979
if: ${{ always() }}
@@ -93,7 +93,7 @@ jobs:
9393

9494
- name: Grunt
9595
if: ${{ always() }}
96-
run: moodle-plugin-ci grunt --max-lint-warnings 0
96+
run: moodle-plugin-ci grunt
9797

9898
- name: PHPUnit tests
9999
if: ${{ always() }}

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org).
77

88
## [Unreleased]
9-
### Changed
10-
-
9+
10+
## [1.2.1] - 2023-08-21
11+
12+
- Changed submission button for student answer changed from Save to Submit.
13+
- Fixed various codestyle issues.
14+
- Added column in qbank view for displaying question text/media
15+
- Swapped the order of firstname and lastname in csv export of attendance list
16+
- Improvement of guest user feedback upon trying to attend a quiz which doesn't allow guests to attend
17+
- Added new template for "guests_not_allowed" feedback
1118

1219
## [1.2.0] - 2023-03-31
1320

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ The teacher can, at a later date, go back through the results and, for each ques
2020
The repolls are treated as separate questions, and you will get a correct order in the review page.
2121

2222
## Documentation
23-
Documentation is available [here](https://github.com/KQMATH/moodle-mod_jazzquiz/wiki), including [installation instructions](https://github.com/KQMATH/moodle-mod_jazzquiz/wiki/Installation-instructions).
23+
24+
25+
Documentation is available as
26+
[github pages](https://kqmath.github.io/) at
27+
[https://kqmath.github.io/docs/jazzquiz/](https://kqmath.github.io/docs/jazzquiz/)
2428

2529
## Feedback:
30+
2631
**Project lead:** Hans Georg Schaathun: <hasc@ntnu.no>
2732

2833
**Developer:** Sebastian S. Gundersen: <sebastsg@stud.ntnu.no>

amd/src/core.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1515

1616
/**
17-
* @package mod_jazzquiz
17+
* @module mod_jazzquiz
1818
* @author Sebastian S. Gundersen <sebastsg@stud.ntnu.no>
1919
* @copyright 2014 University of Wisconsin - Madison
2020
* @copyright 2018 NTNU
2121
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2222
*/
2323

24-
define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function ($, mConfig, mString, Y, mEvent) {
24+
define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function($, mConfig, mString, Y, mEvent) {
2525

2626
// Contains the needed values for using the ajax script.
2727
let session = {
@@ -56,10 +56,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
5656
url: url,
5757
data: data,
5858
dataType: 'json',
59-
success: success,
60-
error: function (xhr, status, error) {
61-
//console.error('XHR Error: ' + error + '. Status: ' + status);
62-
}
59+
success: success
6360
}).fail(() => setText(Quiz.info, 'error_with_request'));
6461
}
6562

@@ -126,6 +123,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
126123
return;
127124
}
128125
Quiz.show(Question.box.html(data.html));
126+
// eslint-disable-next-line no-eval
129127
eval(data.js);
130128
data.css.forEach(cssUrl => {
131129
let head = document.getElementsByTagName('head')[0];
@@ -265,7 +263,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
265263
changeQuizState(state, data) {
266264
this.isNewState = (this.state !== state);
267265
this.state = state;
268-
this.role.onStateChange(state);
266+
this.role.onStateChange();
269267
const event = this.events[state];
270268
this.role[event](data);
271269
}
@@ -342,7 +340,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
342340
static renderMaximaEquation(input, targetId) {
343341
const target = document.getElementById(targetId);
344342
if (target === null) {
345-
//console.error('Target element #' + targetId + ' not found.');
343+
// Log error to console: 'Target element #' + targetId + ' not found.'.
346344
return;
347345
}
348346
if (cache[input] !== undefined) {
@@ -359,10 +357,10 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
359357

360358
/**
361359
* Retrieve a language string that was sent along with the page.
362-
* @param $element
360+
* @param {*} $element
363361
* @param {string} key Which string in the language file we want.
364362
* @param {string} [from=jazzquiz] Which language file we want the string from. Default is jazzquiz.
365-
* @param [args] This is {$a} in the string for the key.
363+
* @param {array} args This is {$a} in the string for the key.
366364
*/
367365
function setText($element, key, from, args) {
368366
from = (from !== undefined) ? from : 'jazzquiz';

amd/src/edit.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1515

16+
17+
import Sortable from '../../js/sortable.min.js';
18+
1619
/**
17-
* @package mod_jazzquiz
20+
* @module mod_jazzquiz
1821
* @author Sebastian S. Gundersen <sebastsg@stud.ntnu.no>
1922
* @copyright 2015 University of Wisconsin - Madison
2023
* @copyright 2018 NTNU
2124
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2225
*/
2326

24-
define(['jquery'], function ($) {
27+
define(['jquery'], function($) {
2528

2629
/**
2730
* Submit the question order to the server. An empty array will delete all questions.
@@ -41,7 +44,7 @@ define(['jquery'], function ($) {
4144
*/
4245
function getQuestionOrder() {
4346
let order = [];
44-
$('.questionlist li').each(function () {
47+
$('.questionlist li').each(function() {
4548
order.push($(this).data('question-id'));
4649
});
4750
return order;
@@ -69,8 +72,12 @@ define(['jquery'], function ($) {
6972
return order;
7073
}
7174

75+
/**
76+
* Add click-listener to a quiz by module id.
77+
* @param {number} courseModuleId
78+
*/
7279
function listenAddToQuiz(courseModuleId) {
73-
$('.jazzquiz-add-selected-questions').on('click', function () {
80+
$('.jazzquiz-add-selected-questions').on('click', function() {
7481
const $checkboxes = $('#categoryquestions td input[type=checkbox]:checked');
7582
let questionIds = '';
7683
for (const checkbox of $checkboxes) {
@@ -86,26 +93,30 @@ define(['jquery'], function ($) {
8693

8794
return {
8895
initialize: courseModuleId => {
89-
$('.edit-question-action').on('click', function () {
96+
$('.edit-question-action').on('click', function() {
9097
const action = $(this).data('action');
9198
const questionId = $(this).data('question-id');
9299
let order = [];
93100
switch (action) {
94-
case 'up':
101+
case 'up': {
95102
order = offsetQuestion(questionId, 1);
96103
break;
97-
case 'down':
104+
}
105+
case 'down': {
98106
order = offsetQuestion(questionId, -1);
99107
break;
100-
case 'delete':
108+
}
109+
case 'delete': {
101110
order = getQuestionOrder();
102111
const index = order.indexOf(questionId);
103112
if (index !== -1) {
104113
order.splice(index, 1);
105114
}
106115
break;
107-
default:
116+
}
117+
default: {
108118
return;
119+
}
109120
}
110121
submitQuestionOrder(order, courseModuleId);
111122
});

amd/src/instructor.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1515

1616
/**
17-
* @package mod_jazzquiz
17+
* @module mod_jazzquiz
1818
* @author Sebastian S. Gundersen <sebastsg@stud.ntnu.no>
1919
* @copyright 2014 University of Wisconsin - Madison
2020
* @copyright 2018 NTNU
2121
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2222
*/
2323

24-
define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
24+
define(['jquery', 'mod_jazzquiz/core'], function($, Jazz) {
2525

2626
const Quiz = Jazz.Quiz;
2727
const Question = Jazz.Question;
@@ -140,7 +140,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
140140
}
141141
$row.addClass('merge-from');
142142
let $table = $row.parent().parent();
143-
$table.find('tr').each(function () {
143+
$table.find('tr').each(function() {
144144
const $cells = $(this).find('td');
145145
if ($cells[1].id !== $barCell.attr('id')) {
146146
$(this).addClass('merge-into');
@@ -233,7 +233,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
233233

234234
// Add rows.
235235
for (let i = 0; i < responses.length; i++) {
236-
//const percent = (parseInt(responses[i].count) / total) * 100;
236+
// Const percent = (parseInt(responses[i].count) / total) * 100;
237237
const percent = (parseInt(responses[i].count) / highestResponseCount) * 100;
238238

239239
// Check if row with same response already exists.
@@ -262,7 +262,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
262262

263263
const countHtml = '<span id="' + name + '_count_' + rowIndex + '">' + responses[i].count + '</span>';
264264
let responseCell = row.insertCell(0);
265-
responseCell.onclick = function () {
265+
responseCell.onclick = function() {
266266
$(this).parent().toggleClass('selected-vote-option');
267267
};
268268

@@ -299,7 +299,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
299299
}
300300
}
301301
}
302-
};
302+
}
303303

304304
/**
305305
* Sort the responses in the graph by how many had the same response.
@@ -440,7 +440,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
440440
}
441441

442442
/**
443-
* refresh() equivalent for votes.
443+
* Method refresh() equivalent for votes.
444444
*/
445445
refreshVotes() {
446446
// Should we show the results?
@@ -687,15 +687,15 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
687687
this.quiz.question.isRunning = false;
688688
}
689689

690-
onSessionClosed(data) {
690+
onSessionClosed() {
691691
Quiz.hide(Instructor.side);
692692
Quiz.hide(Instructor.correctAnswer);
693693
Instructor.enableControls([]);
694694
this.responses.clear();
695695
this.quiz.question.isRunning = false;
696696
}
697697

698-
onVoting(data) {
698+
onVoting() {
699699
if (!this.responses.showResponses) {
700700
this.responses.hide();
701701
}
@@ -704,7 +704,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
704704
this.responses.refreshVotes();
705705
}
706706

707-
onStateChange(state) {
707+
onStateChange() {
708708
$('#region-main').find('ul.nav.nav-tabs').css('display', 'none');
709709
$('#region-main-settings-menu').css('display', 'none');
710710
$('.region_main_settings_menu_proxy').css('display', 'none');
@@ -776,7 +776,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
776776
'jazzquiz-question-id': questions[i].jazzquizquestionid
777777
});
778778
$questionButton.data('test', 1);
779-
$questionButton.on('click', function () {
779+
$questionButton.on('click', function() {
780780
const questionId = $(this).data('question-id');
781781
const time = $(this).data('time');
782782
const jazzQuestionId = $(this).data('jazzquiz-question-id');
@@ -810,6 +810,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
810810
runVoting() {
811811
const options = Instructor.getSelectedAnswersForVote();
812812
const data = {questions: encodeURIComponent(JSON.stringify(options))};
813+
// eslint-disable-next-line no-return-assign
813814
Ajax.post('run_voting', data, () => {});
814815
}
815816

@@ -871,6 +872,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
871872
Quiz.hide(Question.box);
872873
Quiz.hide(Instructor.controls);
873874
setText(Quiz.info, 'closing_session');
875+
// eslint-disable-next-line no-return-assign
874876
Ajax.post('close_session', {}, () => window.location = location.href.split('&')[0]);
875877
}
876878

@@ -947,7 +949,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
947949
}
948950

949951
static addReportEventHandlers() {
950-
$(document).on('click', '#report_overview_controls button', function () {
952+
$(document).on('click', '#report_overview_controls button', function() {
951953
const action = $(this).data('action');
952954
if (action === 'attendance') {
953955
$('#report_overview_responded').fadeIn();
@@ -962,7 +964,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
962964
}
963965

964966
return {
965-
initialize: function (totalQuestions, reportView, slots) {
967+
initialize: function(totalQuestions, reportView, slots) {
966968
let quiz = new Quiz(Instructor);
967969
quiz.role.totalQuestions = totalQuestions;
968970
if (reportView) {
@@ -978,6 +980,6 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
978980
quiz.poll(500);
979981
}
980982
}
981-
}
983+
};
982984

983985
});

0 commit comments

Comments
 (0)