From 1324b43c0e682e79d139a10681a3c245eea79dbc Mon Sep 17 00:00:00 2001 From: Alicia Sykes <=> Date: Sun, 26 Dec 2021 23:14:25 +0000 Subject: [PATCH] :adhesive_bandage: Fixes all minor issues raised by DeepScan --- src/components/Widgets/CryptoPriceChart.vue | 2 +- src/components/Widgets/CryptoWatchList.vue | 2 +- src/components/Widgets/Flights.vue | 2 +- src/components/Widgets/PublicHolidays.vue | 2 +- src/components/Widgets/RssFeed.vue | 2 +- src/components/Widgets/StockPriceChart.vue | 2 +- src/components/Widgets/SystemInfo.vue | 2 +- src/components/Widgets/XkcdComic.vue | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Widgets/CryptoPriceChart.vue b/src/components/Widgets/CryptoPriceChart.vue index ab719740..5d220105 100644 --- a/src/components/Widgets/CryptoPriceChart.vue +++ b/src/components/Widgets/CryptoPriceChart.vue @@ -85,7 +85,7 @@ export default { axios.get(this.endpoint) .then((response) => { try { - this.lineStatuses = this.processData(response.data); + this.processData(response.data); } catch (chartingError) { this.error('Unable to plot results on chart', chartingError); } diff --git a/src/components/Widgets/CryptoWatchList.vue b/src/components/Widgets/CryptoWatchList.vue index 2bf3c635..115f42bf 100644 --- a/src/components/Widgets/CryptoWatchList.vue +++ b/src/components/Widgets/CryptoWatchList.vue @@ -47,7 +47,7 @@ export default { }, limit() { const userChoice = this.options.limit; - if (userChoice && !Number.isNaN(userChoice) && userChoice > 0) return userChoice; + if (userChoice && userChoice > 0) return userChoice; return 100; }, /* How results should be sorted */ diff --git a/src/components/Widgets/Flights.vue b/src/components/Widgets/Flights.vue index c9b0039b..1805f67d 100644 --- a/src/components/Widgets/Flights.vue +++ b/src/components/Widgets/Flights.vue @@ -83,7 +83,7 @@ export default { }, limit() { const usersChoice = this.options.limit; - if (usersChoice && !Number.isNaN(usersChoice)) return usersChoice; + if (usersChoice) return usersChoice; return 8; }, /* The starting date, right now, in ISO String format */ diff --git a/src/components/Widgets/PublicHolidays.vue b/src/components/Widgets/PublicHolidays.vue index c22cc522..2c4690e9 100644 --- a/src/components/Widgets/PublicHolidays.vue +++ b/src/components/Widgets/PublicHolidays.vue @@ -40,7 +40,7 @@ export default { }, monthsToShow() { const usersChoice = this.options.monthsToShow; - if (usersChoice && !Number.isNaN(usersChoice) && usersChoice > 0 && usersChoice <= 24) { + if (usersChoice && usersChoice > 0 && usersChoice <= 24) { return usersChoice; } return 12; diff --git a/src/components/Widgets/RssFeed.vue b/src/components/Widgets/RssFeed.vue index e737ab84..06fc3e75 100644 --- a/src/components/Widgets/RssFeed.vue +++ b/src/components/Widgets/RssFeed.vue @@ -53,7 +53,7 @@ export default { }, limit() { const usersChoice = this.options.limit; - if (usersChoice && !Number.isNaN(usersChoice)) return usersChoice; + if (usersChoice) return usersChoice; return 10; }, orderBy() { diff --git a/src/components/Widgets/StockPriceChart.vue b/src/components/Widgets/StockPriceChart.vue index 655d5d52..a0438ce4 100644 --- a/src/components/Widgets/StockPriceChart.vue +++ b/src/components/Widgets/StockPriceChart.vue @@ -142,7 +142,7 @@ export default { }, /* Format the price, rounding to given number of decimal places */ formatPrice(priceStr) { - const price = parseInt(priceStr, 10); + const price = parseFloat(priceStr, 10); let numDecimals = 0; if (price < 10) numDecimals = 1; if (price < 1) numDecimals = 2; diff --git a/src/components/Widgets/SystemInfo.vue b/src/components/Widgets/SystemInfo.vue index 035abde8..96749512 100644 --- a/src/components/Widgets/SystemInfo.vue +++ b/src/components/Widgets/SystemInfo.vue @@ -40,7 +40,7 @@ export default { return username ? `${username}@` : ''; }, makeUptime(seconds) { - if (!seconds || seconds === 0) return ''; + if (!seconds) return ''; if (seconds < 60) return `${seconds} seconds`; if (seconds < 3600) return `${(seconds / 60).toFixed(1)} minutes`; if (seconds < 86400) return `${(seconds / 3600).toFixed(2)} hours`; diff --git a/src/components/Widgets/XkcdComic.vue b/src/components/Widgets/XkcdComic.vue index ba565f76..5ddd8468 100644 --- a/src/components/Widgets/XkcdComic.vue +++ b/src/components/Widgets/XkcdComic.vue @@ -31,7 +31,7 @@ export default { return 'latest'; } else if (usersChoice === 'random') { return Math.abs(Math.floor(Math.random() * (1 - 2553))); - } else if (!Number.isNaN(usersChoice)) { + } else if (usersChoice) { return usersChoice; } return 'latest';