From ec9747ac18cb0c326d97ce56ef387144da099074 Mon Sep 17 00:00:00 2001 From: Christopher Mattar <69043333+3DCoded@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:47:36 -0400 Subject: [PATCH] feat: Implement working hours See issue #3 --- .gitignore | 3 ++- maintain.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a9f07b8..9a041c3 100644 --- a/.gitignore +++ b/.gitignore @@ -221,4 +221,5 @@ poetry.toml # LSP config files pyrightconfig.json -# End of https://www.toptal.com/developers/gitignore/api/macos,linux,python \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/macos,linux,python +.vscode/sftp.json diff --git a/maintain.py b/maintain.py index 430894b..3f5a05d 100644 --- a/maintain.py +++ b/maintain.py @@ -156,7 +156,14 @@ def cmd_CHECK_MAINTENANCE(self, gcmd): cmd_UPDATE_MAINTENANCE_help = 'Update maintenance' def cmd_UPDATE_MAINTENANCE(self, gcmd): - self.update_db(self.fetch_history()) + data = self.fetch_history() + + hours = gcmd.get_int('HOURS', -1) + if hours > -1 and hours < self.threshold: + new = self.fetch_history()[self.trigger] - hours + data[self.trigger] = new + + self.update_db(data) def load_config(config): return Maintenance(config)