Skip to content

Commit

Permalink
SV-59 Fix CI warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
odeialba committed Aug 30, 2024
1 parent 2247ed6 commit c2c8393
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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

0 comments on commit c2c8393

Please sign in to comment.