Skip to content

Commit

Permalink
Merge pull request #74 from odeialba/SV-59
Browse files Browse the repository at this point in the history
SV-59 Fix CI warnings
  • Loading branch information
odeialba authored Oct 11, 2024
2 parents c31b978 + ee8d0e6 commit 645cd0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions mobile/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class AddonModSortVotingProvider {
votes: votes
};

/* eslint-disable promise/no-nesting */
return site.write('mod_sortvoting_save_vote', params).then((response) => {
if (!response || response.success === false) {
// TODO: Add warnings array to save_vote returns.
Expand All @@ -71,7 +72,10 @@ class AddonModSortVotingProvider {

throw error;
}

return;
});
/* eslint-enable promise/no-nesting */
});
}

Expand All @@ -83,4 +87,5 @@ const result = {
sortVotingProvider: sortVotingProvider,
};

// eslint-disable-next-line no-unused-expressions
result;
7 changes: 5 additions & 2 deletions mobile/js/mobile_sortvoting.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
this.submitResponses = () => {
let promise;
// eslint-disable-next-line promise/no-native
promise = Promise.resolve();
promise.then(() => {
// Show loading modal.
Expand All @@ -39,6 +40,7 @@ this.submitResponses = () => {
});
});

/* eslint-disable promise/no-nesting */
return this.sortVotingProvider.submitResponses(this.module.instance, votes).then(() => {
// Responses have been sent to server or stored to be sent later.
this.CoreDomUtilsProvider.showToast(this.TranslateService.instant('plugin.mod_sortvoting.votesuccess'));
Expand All @@ -53,6 +55,7 @@ this.submitResponses = () => {
}).finally(() => {
modal.dismiss();
});
/* eslint-enable promise/no-nesting */
}).catch(() => {
// User cancelled, ignore.
});
Expand All @@ -64,7 +67,7 @@ this.moveUp = (id) => {
// Change value of the input elements.
var prevId = 0;
var canMove = true;
options.forEach(function (option, index) {
options.forEach(function(option, index) {
if (option.getAttribute('data-optionid') == id) {
if (parseInt(option.value) == option.getAttribute('min')) {
canMove = false;
Expand Down Expand Up @@ -93,7 +96,7 @@ this.moveDown = (id) => {
// Change value of the input elements.
var nextId = 0;
var canMove = true;
options.forEach(function (option, index) {
options.forEach(function(option, index) {
if (option.getAttribute('data-optionid') == id) {
if (parseInt(option.value) == option.getAttribute('max')) {
canMove = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class mod_sortvoting_generator extends testing_module_generator {
* @param array|null $options
* @return stdClass
*/
public function create_instance($record = null, array $options = null) {
public function create_instance($record = null, ?array $options = null) {
$record = (object)(array)$record;

if (!isset($record->timemodified)) {
Expand Down

0 comments on commit 645cd0e

Please sign in to comment.