diff --git a/src/logic/richpresence.py b/src/logic/richpresence.py index d0ed253..67578a7 100644 --- a/src/logic/richpresence.py +++ b/src/logic/richpresence.py @@ -46,17 +46,18 @@ def disconnect(self): self.connected = True return False - def format_time(self, seconds_studied, round_hours_to=1): + def format_time(self, seconds_studied, float_hours=True): total_seconds = seconds_studied total_hours = seconds_studied / 3600 if total_hours < 1: return f"{total_seconds // 60} minute{'s' if total_seconds // 60 != 1 else ''}" else: - return f"{round(total_hours, round_hours_to) if total_hours % 1 != 0 else int(total_hours)} hours" + formatted_hours = round(total_hours, 1) if float_hours and total_hours % 1 != 0 else int(total_hours) + return f"{formatted_hours} hour{'s' if formatted_hours != 1 else ''}" @_handle_exceptions def idling_state(self, seconds_studied=0): - self.update(state=f"Total time studied: {self.format_time(self.total_seconds_studied + seconds_studied, None)}", + self.update(state=f"Total time studied: {self.format_time(self.total_seconds_studied + seconds_studied, False)}", details="Idling", start=self.launch_time, large_image="graytomato",