Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid hitting 100% before print is complete #1455

Merged
merged 1 commit into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/store/farm/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const getters: GetterTree<FarmPrinterState, any> = {
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)
Expand Down
2 changes: 1 addition & 1 deletion src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getters: GetterTree<RootState, any> = {
// 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', {
Expand Down
Loading