From 39590004da7ca22fef82fbd148b31683c462bb13 Mon Sep 17 00:00:00 2001 From: Jamin Collins Date: Sun, 9 Jul 2023 11:32:40 -0600 Subject: [PATCH] fix: avoid hitting 100% before print is complete (#1455) --- src/App.vue | 2 +- src/components/panels/StatusPanel.vue | 2 +- src/store/farm/printer/getters.ts | 2 +- src/store/getters.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index f24eebf0a..24aacef7b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -170,7 +170,7 @@ export default class App extends Mixins(BaseMixin) { } get print_percent(): number { - return Math.round(this.$store.getters['printer/getPrintPercent'] * 100) + return Math.floor(this.$store.getters['printer/getPrintPercent'] * 100) } @Watch('language') diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 190e6ab0b..a7e793541 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -185,7 +185,7 @@ export default class StatusPanel extends Mixins(BaseMixin) { } get printPercent() { - return Math.round(this.$store.getters['printer/getPrintPercent'] * 100) + return Math.floor(this.$store.getters['printer/getPrintPercent'] * 100) } get printerStateOutput() { diff --git a/src/store/farm/printer/getters.ts b/src/store/farm/printer/getters.ts index 41406c149..effebc8b4 100644 --- a/src/store/farm/printer/getters.ts +++ b/src/store/farm/printer/getters.ts @@ -52,7 +52,7 @@ export const getters: GetterTree = { if (state.data.print_stats.state === 'printing') { const percent = getters['getPrintPercent'] - return Math.round(percent * 100) + '% Printing' + return Math.floor(percent * 100) + '% Printing' } return state.data.print_stats.state.charAt(0).toUpperCase() + state.data.print_stats.state.slice(1) diff --git a/src/store/getters.ts b/src/store/getters.ts index c90386100..2cedd12b3 100644 --- a/src/store/getters.ts +++ b/src/store/getters.ts @@ -38,7 +38,7 @@ export const getters: GetterTree = { // return printing title if (printer_state === 'printing') { const eta = getters['printer/getEstimatedTimeETAFormat'] - const percent = (getters['printer/getPrintPercent'] * 100).toFixed(0) + const percent = Math.floor(getters['printer/getPrintPercent'] * 100) if (eta !== '--') { let output = i18n.t('App.Titles.PrintingETA', {