🩹 Fixes all minor issues raised by DeepScan

This commit is contained in:
Alicia Sykes 2021-12-26 23:14:25 +00:00
parent 970b417f44
commit 1324b43c0e
8 changed files with 8 additions and 8 deletions

View File

@ -85,7 +85,7 @@ export default {
axios.get(this.endpoint) axios.get(this.endpoint)
.then((response) => { .then((response) => {
try { try {
this.lineStatuses = this.processData(response.data); this.processData(response.data);
} catch (chartingError) { } catch (chartingError) {
this.error('Unable to plot results on chart', chartingError); this.error('Unable to plot results on chart', chartingError);
} }

View File

@ -47,7 +47,7 @@ export default {
}, },
limit() { limit() {
const userChoice = this.options.limit; const userChoice = this.options.limit;
if (userChoice && !Number.isNaN(userChoice) && userChoice > 0) return userChoice; if (userChoice && userChoice > 0) return userChoice;
return 100; return 100;
}, },
/* How results should be sorted */ /* How results should be sorted */

View File

@ -83,7 +83,7 @@ export default {
}, },
limit() { limit() {
const usersChoice = this.options.limit; const usersChoice = this.options.limit;
if (usersChoice && !Number.isNaN(usersChoice)) return usersChoice; if (usersChoice) return usersChoice;
return 8; return 8;
}, },
/* The starting date, right now, in ISO String format */ /* The starting date, right now, in ISO String format */

View File

@ -40,7 +40,7 @@ export default {
}, },
monthsToShow() { monthsToShow() {
const usersChoice = this.options.monthsToShow; const usersChoice = this.options.monthsToShow;
if (usersChoice && !Number.isNaN(usersChoice) && usersChoice > 0 && usersChoice <= 24) { if (usersChoice && usersChoice > 0 && usersChoice <= 24) {
return usersChoice; return usersChoice;
} }
return 12; return 12;

View File

@ -53,7 +53,7 @@ export default {
}, },
limit() { limit() {
const usersChoice = this.options.limit; const usersChoice = this.options.limit;
if (usersChoice && !Number.isNaN(usersChoice)) return usersChoice; if (usersChoice) return usersChoice;
return 10; return 10;
}, },
orderBy() { orderBy() {

View File

@ -142,7 +142,7 @@ export default {
}, },
/* Format the price, rounding to given number of decimal places */ /* Format the price, rounding to given number of decimal places */
formatPrice(priceStr) { formatPrice(priceStr) {
const price = parseInt(priceStr, 10); const price = parseFloat(priceStr, 10);
let numDecimals = 0; let numDecimals = 0;
if (price < 10) numDecimals = 1; if (price < 10) numDecimals = 1;
if (price < 1) numDecimals = 2; if (price < 1) numDecimals = 2;

View File

@ -40,7 +40,7 @@ export default {
return username ? `${username}@` : ''; return username ? `${username}@` : '';
}, },
makeUptime(seconds) { makeUptime(seconds) {
if (!seconds || seconds === 0) return ''; if (!seconds) return '';
if (seconds < 60) return `${seconds} seconds`; if (seconds < 60) return `${seconds} seconds`;
if (seconds < 3600) return `${(seconds / 60).toFixed(1)} minutes`; if (seconds < 3600) return `${(seconds / 60).toFixed(1)} minutes`;
if (seconds < 86400) return `${(seconds / 3600).toFixed(2)} hours`; if (seconds < 86400) return `${(seconds / 3600).toFixed(2)} hours`;

View File

@ -31,7 +31,7 @@ export default {
return 'latest'; return 'latest';
} else if (usersChoice === 'random') { } else if (usersChoice === 'random') {
return Math.abs(Math.floor(Math.random() * (1 - 2553))); return Math.abs(Math.floor(Math.random() * (1 - 2553)));
} else if (!Number.isNaN(usersChoice)) { } else if (usersChoice) {
return usersChoice; return usersChoice;
} }
return 'latest'; return 'latest';