Skip to content

Commit

Permalink
Merge pull request #33 from CodeMouse92/incrementing_duration
Browse files Browse the repository at this point in the history
fix: Incrementing Duration #21
  • Loading branch information
CodeMouse92 authored Feb 21, 2022
2 parents 5841dfa + ffb3565 commit b6da0dc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/timecard/interface/editview.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,32 @@ def load_item(cls, timestamp):
cls.entry = TimeLog.retrieve_from_log(timestamp)
cls.refresh()

@classmethod
def normalize(cls):
hour = cls.spn_hour.value()
min = cls.spn_min.value()
sec = cls.spn_sec.value()

print(hour, min, sec)

if sec > 60:
min += sec // 60
sec %= 60
if min > 60:
hour += min // 60
min %= 60

print(hour, min, sec)

cls.spn_hour.setValue(hour)
cls.spn_min.setValue(min)
cls.spn_sec.setValue(sec)

@classmethod
def edited(cls):
# Normalize times
cls.normalize()
# Change interface to allow saving or reverting.
cls.btn_done.setEnabled(False)
cls.btn_revert.setEnabled(True)
cls.btn_save.setEnabled(True)
Expand Down

0 comments on commit b6da0dc

Please sign in to comment.