Mercurial > getan
changeset 76:07394c6155e2
Don't crash if subtracted time is greater then the current time
Fixes #1569
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 25 May 2011 14:12:25 +0200 |
parents | fa53e2ec484d |
children | 09a206ba72ae |
files | getan/states.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/states.py Wed May 25 13:42:41 2011 +0200 +++ b/getan/states.py Wed May 25 14:12:25 2011 +0200 @@ -283,9 +283,13 @@ class SubtractTimeState(BaseTimeState): def enter(self): minutes = safe_int(self.view.frame.get_footer().get_edit_text()) + sec = minutes * 60 + if sec > self.state.sec: + self.view._total_time() + return self.state project = self.view.item_in_focus() project.start += timedelta(minutes=minutes) - self.state.sec -= minutes * 60 + self.state.sec -= sec logger.info("SubtractTimeState: subtract %d minutes from project '%s'" % (minutes, project.desc)) self.view._total_time()