Modify

Opened 22 months ago

Last modified 15 months ago

#10704 new defect

trac-post-commit.py Hours not updating in Trac 1.0 (includes fix)

Reported by: Senth Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: waiting-for-feedback
Cc: Trac Release: 1.0

Description

When I updated to Trac 1.0 the Hours field set through trac-post-commit.py, but it stays that way and does not update the total time etc.

I don't know if something went wrong when I updated, but I got a fix. I removed the use of get_db_cnx() which is deprecated.

The patch can be found in the attachment.

Attachments (1)

trac-post-commit.py.patch (2.2 KB) - added by Senth 22 months ago.

Download all attachments as: .zip

Change History (7)

Changed 22 months ago by Senth

comment:1 Changed 22 months ago by bobbysmith007

While I think your patch would work, it shouldn't be necessary (and could possibly cause double time tracking). The TimeTrackingTicketObserver Component is supposed to do this sort of updating whenever a ticket is saved with hours set (whether through the api, web interface, or post commit script). It seems like perhaps this component is not enabled correctly or something.

The following snippet, followed by a ticket save call, should be all that is required.

if (ticket.values.has_key('hours')): 
  ticket['hours'] = str(spentTime)

I think if you fix the database connection stuff, ensure that component is enabled and ensure that you saving ticket hours, then hours should correctly be summed into totalhours and hours should correctly zero out. If this is not happening, we should add some logging and try to come up with the reason (as something similar has been working since trac 10).


Thanks very much for the feedback, and patch

comment:2 Changed 22 months ago by Senth

Yeah, I forgot that it might add the double amount of time for those that the TimeTrackerTicketObserver works for.

I have that enabled, and it works when I manually add to the hours field (through the browser), but not via the script.

comment:3 Changed 22 months ago by bobbysmith007

That's odd... previously it has always worked through the script as well. Trac has been trying to get me to update the post commit script to the new (as of .12) way of doing post commit hooks. I guess perhaps its time to investigate the new hook structure more thoroughly.

Thanks again for your feedback,

Russ

comment:4 Changed 20 months ago by bobbysmith007

Just an FYI I am in the process of upgrading to trac1.0 now so hopefully this will get taken care of soon.

comment:5 Changed 19 months ago by bobbysmith007

After upgrading to trac 1.0 my old commit hooks still work. Perhaps there is some conflict between the built-in CommitTicketUpdater — Update tickets based on commit messages. component and the scripts provided (though it seems unlikely).

Adding logging statements to the commit hooks and setting up logging to be verbose is probably the only way to track this down since it works for me. Also please verify there are no errors in your regular trac log.

Thanks again for the bug report, I hope we can get things fixed for you (and anyone else experiencing this error)

comment:6 Changed 15 months ago by bobbysmith007

  • Keywords waiting-for-feedback added

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.