Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- worklog.orig/manager.py 2016-01-05 10:40:19.621308861 +0100
- +++ worklog/manager.py 2016-01-05 11:57:38.973366636 +0100
- @@ -7,7 +7,10 @@
- from trac.ticket import Ticket
- from trac.util.datefmt import format_date, format_time, pretty_timedelta, \
- to_datetime
- -
- +try:
- + from trachours.hours import TracHoursPlugin
- +except ImportError:
- + pass
- class WorkLogManager:
- env = None
- @@ -172,6 +175,7 @@
- message = ''
- hours = '0.0'
- + seconds = 0;
- # Leave a comment if the user has configured this or if they have entered
- # a work log comment.
- @@ -179,7 +183,8 @@
- round_delta = float(self.config.getint('worklog', 'roundup') or 1)
- # Get the delta in minutes
- - delta = float(int(stoptime) - int(active['starttime'])) / float(60)
- + seconds = float(int(stoptime) - int(active['starttime']))
- + delta = seconds / float(60)
- # Round up if needed
- delta = int(round((delta / round_delta) + float(0.5))) * int(round_delta)
- @@ -189,7 +194,9 @@
- hours = str(float(int(100 * float(delta) / 60) / 100.0))
- if plughrs:
- - message = 'Hours recorded automatically by the worklog plugin. %s hours' % hours
- + hoursmessage = 'Hours recorded automatically by the worklog plugin. %s hours' % hours
- + ticket = Ticket(self.env, active['ticket'])
- + TracHoursPlugin(self.env).add_ticket_hours(ticket.id, self.authname, seconds, comments=hoursmessage)
- elif self.config.getbool('worklog', 'comment') or comment:
- started = datetime.fromtimestamp(active['starttime'])
- finished = datetime.fromtimestamp(stoptime)
- @@ -200,7 +207,7 @@
- if comment:
- message += "\n[[BR]]\n" + comment
- - if plugtne or plughrs:
- + if plugtne:
- if not message:
- message = 'Hours recorded automatically by the worklog plugin.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement