Skip to content

Commit

Permalink
chg: user: try rounding a Decimal for timer status
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Aug 13, 2024
1 parent e2b4740 commit e3a96ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scripts/timew-status-indicator
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import time
import typing
from collections import Counter
from datetime import timedelta
from decimal import Decimal
from threading import Thread
from typing import cast

Expand Down Expand Up @@ -210,7 +211,8 @@ class Indicator:

def reset_counter(self, source):
"""Reset the seat_time counter"""
seat_minutes = COUNT["SeatTick"] / 60
seat_time = COUNT["SeatTick"] / 60
seat_minutes = round(Decimal(seat_time), 1)
COUNT.clear()
msg = f'INFO: seat timer reset from {seat_minutes} to 0 min'
Notify.Notification.new("Timew status", msg, None).show()
Expand All @@ -227,6 +229,8 @@ class Indicator:

def statusd(self, source):
_, svc_msg = run_cmd()
seat_minutes = round(Decimal(COUNT["SeatTick"] / 60), 1)
svc_msg = f'INFO: current seat time is {seat_minutes} mins \n' + svc_msg
Notify.Notification.new("Timew status", svc_msg, None).show()

def stopd(self, source):
Expand Down
2 changes: 1 addition & 1 deletion src/timew_status/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def run_cmd(action='status', tag=None):
print(f'run_cmd {action} return code: {result.returncode}')
print(f'run_cmd {action} result msg: {result.stdout.decode().strip()}')

return result, result.stdout.decode().strip()
return result, result.stdout.decode()

except Exception as exc:
print(f'run_cmd exception: {exc}')
Expand Down

0 comments on commit e3a96ab

Please sign in to comment.