Skip to content

Commit

Permalink
Don't report progress on 100 and better times
Browse files Browse the repository at this point in the history
Fixes #5 and fixes #6
  • Loading branch information
Cadair committed Jul 22, 2021
1 parent f60fab9 commit e16a36c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions octoprint_matrix_notifier/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_settings_defaults(self):
**File**: {filename}
**User**: {user}
**Time**: {elapsed_time} / {total_estimated_time}
**Elapsed Time**: {elapsed_time}
{temperature}
"""),
"enabled": True,
Expand All @@ -59,7 +59,7 @@ def get_settings_defaults(self):
**File**: {filename}
**User**: {user}
**Time**: {elapsed_time} / {total_estimated_time}
**Elapsed Time**: {elapsed_time}
{temperature}
"""),
"enabled": True,
Expand All @@ -70,7 +70,9 @@ def get_settings_defaults(self):
**File**: {filename}
**User**: {user}
**Time**: {elapsed_time} / {total_estimated_time}
**Elapsed Time**: {elapsed_time}
**Remaining Time**: {remaining_time}
**Total Estimated Time**:{total_estimated_time}
{temperature}
"""),
"enabled": True,
Expand All @@ -81,7 +83,9 @@ def get_settings_defaults(self):
**File**: {filename}
**User**: {user}
**Time**: {elapsed_time} / {total_estimated_time}
**Elapsed Time**: {elapsed_time}
**Remaining Time**: {remaining_time}
**Total Estimated Time**:{total_estimated_time}
{temperature}
"""),
"enabled": True,
Expand Down Expand Up @@ -210,7 +214,10 @@ def on_event(self, event, payload):

def on_print_progress(self, storage, path, progress):
interval = self._settings.get(["events", "progress", "interval"]) or 1
if not progress or not(progress / interval == progress // interval):
# Do not report if no progress, the progress isn't a multiple of
# interval or the progress is 100% because we have PrintCompleted for
# that.
if not progress or not(progress / interval == progress // interval) or progress == 100:
return

if self._settings.get(["events", "progress", "enabled"]):
Expand Down

0 comments on commit e16a36c

Please sign in to comment.