From d9aea5a16e232c231a2aa01309c97001b9db23d4 Mon Sep 17 00:00:00 2001 From: Dmitry Burnyshev Date: Mon, 29 Jan 2024 15:24:49 +0100 Subject: [PATCH] 0.8.2-beta (#96) * BUG: srvCreated replacement to date in NS APIv3 request * BUG: Workaround for NS 15.0.2 limit out of tolerance error * DOC: Updates app version in related documents * CI: Adds Issue template form on GitHub --- .github/ISSUE_TEMPLATE/bug-report.yml | 2 +- .github/workflows/check.yml | 2 +- README.md | 10 +++++----- docs/README.it.md | 10 +++++----- docs/README.pl.md | 10 +++++----- docs/README.ru.md | 10 +++++----- js/backend.js | 6 +++--- js/util.js | 2 +- package.json | 2 +- test/util.test.js | 16 ++++++++-------- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 8c51971..737feb6 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -53,7 +53,7 @@ body: label: Application version description: What version of our software are you running? options: - - 0.8.1-beta (Latest) + - 0.8.2-beta (Latest) - other (specify in description) default: 0 validations: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 462849f..621bc6d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -46,5 +46,5 @@ jobs: - name: Install dependencies run: npm install - - name: Check README files version + - name: Check version-related files run: npm run version-check diff --git a/README.md b/README.md index ec421c6..0333e89 100644 --- a/README.md +++ b/README.md @@ -36,15 +36,15 @@ I was inspired by the [mlukasek/M5_NightscoutMon](https://github.com/mlukasek/M5 ## Installation packages -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.2-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/README.it.md b/docs/README.it.md index 27ed542..c563a46 100644 --- a/docs/README.it.md +++ b/docs/README.it.md @@ -35,15 +35,15 @@ Sono stato inspirato dalla soluzione [mlukasek/M5_NightscoutMon](https://github. ## Pacchetti di installazione -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.2-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/README.pl.md b/docs/README.pl.md index b26bd0c..112802c 100644 --- a/docs/README.pl.md +++ b/docs/README.pl.md @@ -35,15 +35,15 @@ Zainspirowałem się rozwiązaniem [mlukasek/M5_NightscoutMon](https://github.co ## Gotowe pakiety instalacyjne -[![Pobierz dla systemu Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) +[![Pobierz dla systemu Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-win-x64.exe) -[![Pobierz dla systemu macOS (procesory Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) +[![Pobierz dla systemu macOS (procesory Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-arm64.dmg) -[![Pobierz dla systemu macOS (procesory Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) +[![Pobierz dla systemu macOS (procesory Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-x64.dmg) -[![Pobierz dla systemów Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) +[![Pobierz dla systemów Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-linux-x86_64.AppImage) -[![Pobierz źródła](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) +[![Pobierz źródła](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.2-beta.tar.gz) [![Pobierz źródła](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/README.ru.md b/docs/README.ru.md index 9de6f5e..a95dc8c 100644 --- a/docs/README.ru.md +++ b/docs/README.ru.md @@ -35,15 +35,15 @@ ## Установка приложения -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.2-beta/Owlet-0.8.2-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.2-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/js/backend.js b/js/backend.js index 8e44d6d..280cad3 100644 --- a/js/backend.js +++ b/js/backend.js @@ -23,8 +23,8 @@ const Fallback = { const GetParams = { SORT_BY: `date`, - LIMIT: 6, - FIELDS: `sgv,direction,srvCreated`, + LIMIT: 10, + FIELDS: `sgv,direction,date`, TYPE: `sgv`, TOKEN: null, }; @@ -38,7 +38,7 @@ const fallbackTransform = (dataObj) => { transformedData.result = dataObj.map(item => ({ direction: item.direction, sgv: item.sgv, - srvCreated: item.mills + date: item.mills })); } diff --git a/js/util.js b/js/util.js index c364ae7..06b35d8 100644 --- a/js/util.js +++ b/js/util.js @@ -122,7 +122,7 @@ const prepareData = (dataObj, paramsObj) => { result.prev = dataObj.result[1].sgv; const currentTime = new Date(); - result.age = Math.floor((currentTime.getTime() - dataObj.result[0].srvCreated) / 1000 / 60); + result.age = Math.floor((currentTime.getTime() - dataObj.result[0].date) / 1000 / 60); let delta = Math.round((result.last - result.prev) * 100) / 100; diff --git a/package.json b/package.json index 2f48632..1dc0746 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "email": "dmitry.burnyshev@gmail.com" }, "homepage": "https://github.com/kashamalasha/nightscout-widget-electron", - "version": "0.8.1-beta", + "version": "0.8.2-beta", "main": "main.js", "scripts": { "start": "NODE_ENV=production electron .", diff --git a/test/util.test.js b/test/util.test.js index 40fd23c..b3b041b 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -429,12 +429,12 @@ describe(`customAssign`, () => { describe(`prepareData`, () => { const dataObj = { result: [ - { sgv: 90, srvCreated: new Date().getTime() - 3 * 60 * 1000 , direction: `FortyFiveUp`}, - { sgv: 80, srvCreated: new Date().getTime() - 8 * 60 * 1000 , direction: `Flat`}, - { sgv: 80, srvCreated: new Date().getTime() - 12 * 60 * 1000 , direction: `Flat`}, - { sgv: 80, srvCreated: new Date().getTime() - 17 * 60 * 1000 , direction: `Flat`}, - { sgv: 80, srvCreated: new Date().getTime() - 22 * 60 * 1000 , direction: `Flat`}, - { sgv: 80, srvCreated: new Date().getTime() - 27 * 60 * 1000 , direction: `Flat`}, + { sgv: 90, date: new Date().getTime() - 3 * 60 * 1000 , direction: `FortyFiveUp`}, + { sgv: 80, date: new Date().getTime() - 8 * 60 * 1000 , direction: `Flat`}, + { sgv: 80, date: new Date().getTime() - 12 * 60 * 1000 , direction: `Flat`}, + { sgv: 80, date: new Date().getTime() - 17 * 60 * 1000 , direction: `Flat`}, + { sgv: 80, date: new Date().getTime() - 22 * 60 * 1000 , direction: `Flat`}, + { sgv: 80, date: new Date().getTime() - 27 * 60 * 1000 , direction: `Flat`}, ], }; @@ -454,7 +454,7 @@ describe(`prepareData`, () => { }); it(`should prepare data with the correct delta calculation (< 0)`, () => { dataObj.result.unshift( - { sgv: 80, srvCreated: new Date().getTime(), direction: `FortyFiveDown`} + { sgv: 80, date: new Date().getTime(), direction: `FortyFiveDown`} ); const result = prepareData(dataObj, paramsObj); @@ -483,7 +483,7 @@ describe(`prepareData`, () => { }); it(`should prepare data with the correct delta calculation (< 0)`, () => { dataObj.result.unshift( - { sgv: 80, srvCreated: new Date().getTime(), direction: `FortyFiveDown`} + { sgv: 80, date: new Date().getTime(), direction: `FortyFiveDown`} ); const result = prepareData(dataObj, paramsObjMMOL);