Opened 9 years ago

Closed 9 years ago

# Total hours not updated and Add Hours to Ticket not reset to 0

Reported by: Owned by: halstead@… bobbysmith007 normal TimingAndEstimationPlugin normal 0.11

### Description

Plugin is working as expected when running these versions:

*Trac 0.11dev-r6021
*timingandestimationplugin 0.4.9

After updating to the most current revisions,

*Trac-0.11dev_r6253
*timingandestimationplugin-0.5.7

Total Hours are no longer updated when saving a ticket and the Add Hours to Ticket isn't reset to 0 and instead retains the number entered.

I am attaching the debug log that is generated when submitting a ticket and Total Hours isn't updated.

### comment:1 Changed 9 years ago by halstead

Upon further testing it might be good to note that the combination of,

*Trac 0.11dev-r6021 and *timingandestimationplugin-0.5.7

seems to work just fine. I presume that means that the main development in trac has changed something that breaks the plugin code.

Does this mean the plugin needs to catch up with changes in trac or something else?

### comment:2 Changed 9 years ago by bobbysmith007

For me its working with:

Trac:  	0.11dev-r6254
timingandestimationplugin 0.5.7

• Are you sure you have the TimeTrackingTicketObserver part of the plugin enabled? This is the part of the plugin that actually moves the ticket hours to the total hours field, so if disabled the bugs you are reporting would be there.
• timingandestimationplugin.ticket_daemon = enabled in trac.ini or webadmin screen will turn this back on if it is disabled.

### comment:3 Changed 9 years ago by anonymous

I did further testing and it breaks for me at trac0.11 r6139. It works fine a revision r6138. Is that helpful?

BTW: This is what I have in my trac.ini

[components]
timingandestimationplugin.api.timetrackingsetupparticipant = enabled
timingandestimationplugin.tande_filters.reportsfilter = enabled
timingandestimationplugin.tande_filters.totalhoursfilter = enabled
timingandestimationplugin.ticket_daemon.timetrackingticketobserver = enabled
timingandestimationplugin.webui.timingestimationandbillingpage = enabled


timingandestimationplugin.ticket_daemon = enabled

to no effect.

### comment:4 Changed 9 years ago by bobbysmith007

r6139 was a huge revision... not much chance I can spot what changed. It seems strange to me what it works at a revision 100 past that for me. I will not be around for the rest of the day, but will try to have an answer on monday at some point.

### comment:5 Changed 9 years ago by bobbysmith007

Sorry it took me a while to get back, other projects preempted this for a few days. I still have this working on trac head with latest revision of the plugin.

To help debug this I have added more logging to the ticket observer.

Try:

• uninstalling / removing all other versions of the plugin
• make sure logging is also enabled
• install the egg version of this plugin attached to this ticket
• enable the plugin (if it is not currently)
• try adding hours to a ticket
• post your log to this ticket so I can try to figure out what is broken

Log should have something like this in it:

2007-12-06 17:55:54,636 Trac[ticket_daemon] DEBUG: Loading Time Tracking Ticket Observer
2007-12-06 17:55:54,637 Trac[ticket_daemon] DEBUG: Observer watching...
2007-12-06 17:55:54,638 Trac[ticket_daemon] DEBUG: Observing ticket change hours:-0.75 total:4.75
2007-12-06 17:55:54,650 Trac[ticket_daemon] DEBUG: About to save ticket
2007-12-06 17:55:54,655 Trac[ticket_daemon] DEBUG: Done observing ticket changes


Thanks, and sorry again for the delay

Russ

### Changed 9 years ago by bobbysmith007

Extra logging of ticket observer

### comment:6 Changed 9 years ago by halstead

I apologise for not following up sooner. Here is the output you asked for and the whole debug log is attached.

First I upgraded to the newest version of trac 0.11 (r6317) and installed the attached egg. Next I restarted trac and checked the versions. Then created a new ticket, tried to add one hour, just clicked save again, and changed the number of hours to two and saved again.

The behavior was the same as before.

2007-12-11 14:40:13,884 Trac[ticket_daemon] DEBUG: Observer watching...
2007-12-11 14:40:13,885 Trac[ticket_daemon] DEBUG: Observing ticket change hours:1.0 total:0.0
2007-12-11 14:40:13,886 Trac[ticket_daemon] DEBUG: About to save ticket
2007-12-11 14:40:13,887 Trac[ticket_daemon] DEBUG: Done observing ticket changes

2007-12-11 14:40:54,055 Trac[ticket_daemon] DEBUG: Observer watching...
2007-12-11 14:40:54,055 Trac[ticket_daemon] DEBUG: Observing ticket change hours:1.0 total:0.0
2007-12-11 14:40:54,057 Trac[ticket_daemon] DEBUG: About to save ticket
2007-12-11 14:40:54,058 Trac[ticket_daemon] DEBUG: Done observing ticket changes

2007-12-11 14:41:13,612 Trac[ticket_daemon] DEBUG: Observer watching...
2007-12-11 14:41:13,613 Trac[ticket_daemon] DEBUG: Observing ticket change hours:2.0 total:0.0
2007-12-11 14:41:13,614 Trac[ticket_daemon] DEBUG: About to save ticket
2007-12-11 14:41:13,616 Trac[ticket_daemon] DEBUG: Done observing ticket changes



### Changed 9 years ago by halstead

New debug log from enhanced logging egg

### comment:7 Changed 9 years ago by bobbysmith007

wow... so the ticket observer is working (is at least not throwing an error in its process). I am a bit stumped here :(. I was just about to go home for the day, but I will think about this and try to get back to you tomorrow.

Russ

### comment:8 Changed 9 years ago by bobbysmith007

Ok I think that I might have had an insight. What database backend are you using?

If the database you are using does not have autocommit enabled, I could see that causing the error you are experiencing. I dont know what would have changed between the revisions you found, but I noticed that this database code does not go thorough the normal database communication paths and so was missing a commit at the end (not been a problem on my version of sqlite).

I will attach a new egg in a second to see if that is the issue.

Thanks for your patience in getting this resolved.

Russ

### Changed 9 years ago by bobbysmith007

Egg with db.commits in place

### comment:9 Changed 9 years ago by sean.wedig@…

I've been having what appears to be the same problem, and I can confirm that the egg you published with db.commits in place works to update the totalhours. Thanks for the lifesaver fix!

Just for reference:

• Trac 0.11-r6326
• Timing and Estimation - 0.5.7 (w/db.commits, as submitted)
• sqlite database
• sqlite v.3.4.2

### comment:10 Changed 9 years ago by bobbysmith007

• Resolution set to fixed
• Status changed from new to closed

(In [2893]) closes #2239

Fixed bug where db.commit became necessary and wasnt being called. This was causing the ticket observer to fail in it duties. Also fixed a potential bug in dbhelper having to do with iterating over None.