Changeset 2449
- Timestamp:
- 07/10/07 17:59:40 (1 year ago)
- Files:
-
- worklogplugin/0.10/worklog/manager.py (modified) (2 diffs)
- worklogplugin/0.10/worklog/templates/webadminui.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worklogplugin/0.10/worklog/manager.py
r2448 r2449 1 1 from time import time 2 from datetime import tzinfo, timedelta, datetime 3 from util import pretty_timedelta 2 4 from trac.ticket.notification import TicketNotifyEmail 3 5 from trac.ticket import Ticket 4 6 from trac.ticket.web_ui import TicketModule 7 from trac.util.datefmt import format_date, format_time 5 8 6 9 class WorkLogManager: … … 156 159 'WHERE user=%s AND lastchange=%s AND endtime=0', 157 160 (stoptime, stoptime, self.authname, active['lastchange'])) 161 162 message = '' 163 if self.config.getbool('worklog', 'comment'): 164 started = datetime.fromtimestamp(active['starttime']) 165 finished = datetime.fromtimestamp(stoptime) 166 message = '%s worked on this ticket for %s between %s %s and %s %s' % \ 167 (self.authname, pretty_timedelta(started, finished), \ 168 format_date(active['starttime']), format_time(active['starttime']), \ 169 format_date(stoptime), format_time(stoptime)) 170 if self.config.getbool('worklog', 'timingandestimation') and \ 171 self.config.get('ticket-custom', 'hours'): 172 if not message: 173 message = 'Hours recorded automatically by the worklog plugin.' 174 175 round_delta = float(self.config.getint('worklog', 'roundup') or 1) 176 177 # Get the delta in minutes 178 delta = float(int(stoptime) - int(active['starttime'])) / float(60) 179 180 # Round up if needed 181 delta = int(round((delta / round_delta) + float(0.5))) * int(round_delta) 182 183 db = self.env.get_db_cnx() 184 tckt = Ticket(self.env, active['ticket'], db) 185 tckt['hours'] = str(float(delta) / 60) 186 self.save_ticket(tckt, db, message) 187 message = '' 188 189 if message: 190 db = self.env.get_db_cnx() 191 tckt = Ticket(self.env, active['ticket'], db) 192 self.save_ticket(tckt, db, message) 193 158 194 return True 159 195 worklogplugin/0.10/worklog/templates/webadminui.cs
r2434 r2449 4 4 <fieldset> 5 5 <legend>Options:</legend> 6 <p style="font-weight: bold">7 The options below that have a line through them do not currently work!<br>8 Implementations will come in time, please be patient!9 </p>10 6 <div class="field"> 11 7 <input type="checkbox" id="timingandestimation" name="timingandestimation" value="1" <?cs var:settings.timingandestimation ?>> 12 <label for="timingandestimation" style="text-decoration: line-through">Record time via <a href="http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin">Timing and Estimation Plugin</a>?</label>8 <label for="timingandestimation">Record time via <a href="http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin">Timing and Estimation Plugin</a>?</label> 13 9 </div> 14 10 <div class="field"> 15 11 <input type="checkbox" id="comment" name="comment" value="1" <?cs var:settings.comment ?>> 16 <label for="comment" style="text-decoration: line-through">Automatically add a comment when you stop work on a ticket?</label>12 <label for="comment">Automatically add a comment when you stop work on a ticket?</label> 17 13 </div> 18 14 <div class="field">
