Skip to content

Commit

Permalink
Adapt ci config.
Browse files Browse the repository at this point in the history
  • Loading branch information
srobotta committed Dec 22, 2024
1 parent 70f267a commit 2d7c7d0
Show file tree
Hide file tree
Showing 24 changed files with 198 additions and 165 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

mariadb:
image: mariadb:10.6
image: mariadb:10
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
Expand Down Expand Up @@ -138,9 +138,9 @@ jobs:
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
IGNORE_PATHS: 'moodle/tests/fixtures,moodle/Sniffs,classes/vendor'
PHPCS_IGNORE_PATHS: /^classes\/vendor/
PHPDOCCHECKER_IGNORE_PATHS: /^classes\/vendor/
IGNORE_PATHS: 'moodle/tests/fixtures,moodle/Sniffs,classes/vendor,fonts'
PHPCS_IGNORE_PATHS: '/^classes\/vendor/,/^fonts/'
PHPDOCCHECKER_IGNORE_PATHS: '/^classes\/vendor/,/^fonts/'
MUSTACHE_IGNORE_NAMES: 'report.mustache,questionnaire.mustache'

- name: PHP Lint
Expand All @@ -154,11 +154,11 @@ jobs:

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci phpcs --max-warnings 0 || true
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc || true
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
Expand All @@ -169,17 +169,16 @@ jobs:
run: moodle-plugin-ci savepoints

- name: Mustache Lint
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
run: moodle-plugin-ci grunt || true
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
run: moodle-plugin-ci phpunit --coverage-text || true
run: moodle-plugin-ci phpunit --fail-on-warning

- name: Behat features
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion amd/build/edit_items.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/questionnaire.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion amd/build/report.min.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions amd/src/edit_items.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ define([
sum += parseFloat($(this).val());
});

if(sum != 1) {
if (sum != 1) {
$('.category-percentage').addClass('is-invalid');
$('#percentage-total').addClass('text-danger');
$('#percentage-total-value').text(parseFloat(sum * 100).toFixed(2));
Expand Down Expand Up @@ -113,7 +113,7 @@ define([

$(ACTIONS.ITEM_MULTIPLIER_CHANGED).change(function(e) {
e.preventDefault();
if(this.value > 5) {
if (this.value > 5) {
this.value = 5.00;
}
this.value = parseFloat(this.value).toFixed(2);
Expand Down
29 changes: 14 additions & 15 deletions amd/src/questionnaire.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ define(['jquery',
}
};

const getComment = function (row, classSel) {
const getComment = function(row, classSel) {
if (getEditor() === 'atto') {
let comment = row.find(classSel + '.editor_atto_content').html();
return comment.replace(/<[^>]+>/g,'').trim() === '' ? '' : comment; // drop empty comments
return comment.replace(/<[^>]+>/g, '').trim() === '' ? '' : comment; // Drop empty comments.
}
const commentId = row.find(classSel).attr('id');
if (commentId) {
Expand All @@ -92,7 +92,7 @@ define(['jquery',
} else {
comment = $('#' + commentId).val();
}
return comment.replace(/<[^>]+>/g,'').trim() === '' ? '' : comment; // drop empty comments
return comment.replace(/<[^>]+>/g, '').trim() === '' ? '' : comment; // Drop empty comments.
}
return '';
};
Expand All @@ -112,8 +112,8 @@ define(['jquery',

let questionnaireTable = $('[data-region="questionnaire"]');

if(questionnaireTable.data('preview') == true) { // dont use '===' as $preview is '1' not 'true'.
// do not look for existing submission on preview page
if (questionnaireTable.data('preview') == true) { // Dont use '===' as $preview is '1' not 'true'.
// Do not look for existing submission on preview page.
return;
}

Expand All @@ -137,10 +137,10 @@ define(['jquery',
promises[0].done(function(result) {
$.each(result.responses, function() {
let response = this;
responses[response.criterionid]['criterionid'] = response.criterionid;
responses[response.criterionid]['value'] = response.value;
responses[response.criterionid]['studentcomment'] = response.studentcomment;
responses[response.criterionid]['privatecomment'] = response.privatecomment;
responses[response.criterionid].criterionid = response.criterionid;
responses[response.criterionid].value = response.value;
responses[response.criterionid].studentcomment = response.studentcomment;
responses[response.criterionid].privatecomment = response.privatecomment;

$('[data-region="question-row"]').each(function() {
if ($(this).data('criterionid') === response.criterionid) {
Expand Down Expand Up @@ -204,9 +204,9 @@ define(['jquery',

// Add this selected value to the array of responses.
if (selected.data('value') === "") { // === is necessary because == "0" equals true;
responses[criterionid]['value'] = null;
responses[criterionid].value = null;
} else {
responses[criterionid]['value'] = selected.data('value');
responses[criterionid].value = selected.data('value');
}
});

Expand Down Expand Up @@ -258,7 +258,7 @@ define(['jquery',
e.preventDefault();
let row = $(this).parents('[data-region="question-row"]');
let detailedRating = row.find(".detailed-rating");
if(detailedRating.hasClass("hidden")) {
if (detailedRating.hasClass("hidden")) {
detailedRating.removeClass("hidden");
$(this).html("−");
} else {
Expand All @@ -278,11 +278,11 @@ define(['jquery',

$('.student-comment').each(function() {
let row = $(this).parents('[data-region="question-row"]');
responses[row.data('criterionid')]['studentcomment'] = getComment(row,'.student-comment');
responses[row.data('criterionid')].studentcomment = getComment(row, '.student-comment');
});
$('.private-comment').each(function() {
let row = $(this).parents('[data-region="question-row"]');
responses[row.data('criterionid')]['privatecomment'] = getComment(row, '.private-comment');
responses[row.data('criterionid')].privatecomment = getComment(row, '.private-comment');
});

let questionnaireTable = $('[data-region="questionnaire"]');
Expand Down Expand Up @@ -348,7 +348,6 @@ define(['jquery',
]);

promises[0].done(function(response) {
// console.log(response);
let messageStrings = [
{
key: 'responsessaved',
Expand Down
Loading

0 comments on commit 2d7c7d0

Please sign in to comment.