Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7471 closed task (wontfix)

Log hours on different date

Reported by: Jochus Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: patch useful-sql
Cc: Trac Release: 0.12



Is it possible to log hours on a date in the past? I'm willing to do this, to make sure my burndown chart looks ok :-) !


Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by bobbysmith007

  • Keywords patch useful-sql added
  • Resolution set to wontfix
  • Status changed from new to closed

You can certainly manually insert hours/totalhours changes into the ticket_change table in trac. It will be a little ugly to update the total hours on every ticket change after that time, but doable.

! THIS IS TOTALLY UNDEBUGGED, USE WITH CARE: Obviously, use python or your database's parameter syntax, but something like:

  $total_hours = (SELECT SUM(newvalue)
                  FROM ticket_change 
                  WHERE ticket=$ticket_id and time < $change_timestamp and field='hours')

  INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue)
  VALUES( $ticket_id, $change_timestamp, $change_author, 'hours', 0 , $hours_to_add )

  INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue)
  VALUES( $ticket_id, $change_timestamp, $change_author, 'total_hours',
          $total_hours , $total_hours + $hours_to_add );

  UPDATE ticket_change 
     SET old_value = old_value + $hours_to_add, 
         new_value = new_value + $hours_to_add
   WHERE ticket=$ticket_id and time > $change_timestamp and

   UPDATE ticket_custom SET value = value + $hours_to_add 
    WHERE ticket=$ticket_id and name='totalhours';

However, this falls outside of my usage case for this plugin. My company is happy to write you a plugin that can supply this additional functionality, but I am unable to donate time towards this.

Thanks for your understanding,

Russ Tyndall

comment:2 Changed 5 years ago by bobbysmith007

As an aside this could probably be done as an admin page or something. I was initially very concerned about adding more fields to the layout, as that is already a bit of box soup.

Also patches welcome, if you take the above code and turn it into a patch that adds an admin page, I will happily include it in the plugin

comment:3 Changed 5 years ago by Jochus


Thanks! :-) ! I'm willing to patch this, but I also need to find time to do this :-)


Add Comment

Modify Ticket

as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.