Skip to content

Commit

Permalink
avoid hitting 100% before print is complete
Browse files Browse the repository at this point in the history
The existing implementation will report 100% from 99.5% on, due to
round(). Switching to floor() instead, which will report 99% until
complete.

Signed-off-by: Jamin W. Collins <[email protected]>
  • Loading branch information
jamincollins committed Jul 8, 2023
1 parent ef2d17c commit c39ac29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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/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

0 comments on commit c39ac29

Please sign in to comment.