Modify

Opened 12 years ago

Closed 7 years ago

#10704 closed defect (worksforme)

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

Reported by: Matteus Owned by: Russ Tyndall
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 Matteus 12 years ago.

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by Matteus

Attachment: trac-post-commit.py.patch added

comment:1 Changed 12 years ago by Russ Tyndall

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 12 years ago by Matteus

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 12 years ago by Russ Tyndall

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 12 years ago by Russ Tyndall

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 12 years ago by Russ Tyndall

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 11 years ago by Russ Tyndall

Keywords: waiting-for-feedback added

comment:7 Changed 7 years ago by Russ Tyndall

Resolution: worksforme
Status: newclosed

Works for me

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.