Are the SQLite date and time functions [1] not sufficient for this?
Other database backends presumably have similar functionality.

[1] http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions


On 11/21/07, Christopher Taylor <[EMAIL PROTECTED]> wrote:
>
> >
> >
> > > unfortunately, I had to write this into report.py.  I don't suppose
> ya'll
> > > would like this patch?  I could aldd a few other things like $THISWEEK,
> > > $THISMONTH but we dont' really have a need for that.
> >
> > I'm curious as to what you use these variables for in the reports
> > you've done? The TNE manager passes in dynamic variables into the
> > reports so it should be easy enough to modify it to pass in these
> > specific values if they are genuinely useful (e.g. calculate them in
> > real time when generating the report links - it should just be a small
> > change to linkify.js).
>
>
> well i added chargenumber as a custom ticket field and a report that reports
> how many hours the current user charged to a given charge number that day
> ... this helps them fill out daily time cards.... it was a lot more
> convienient than having the developers type in the date in the mgt tab each
> day ... there's some more work that needs to be done ... specifically I need
> to tabulate each charge number individually...
>
> as for putting these in the linkify.js, I suppose that would work and it
> would be a lot easier from a maintenance perspective .... unfortunately, I
> need this report as easy as possible for the other developers to use so
> they'll use it to build their timecards...
>
> >
> >
> >
> > > Any suggestion on how to make this part of the plugin so I don't have to
> > > hack the core code? ... it doesn't look like there's an interface to add
> > > default report variables with a plugin, but I could be missing it.
> >
> > I'm not convinced you need to add them. The whole point in upper case
> > $XXXX values is that they are provided by get arguments passed in, not
> > generated internally by trac. Perhaps post your patch and some
> > examples that make use of it will make things clearer.
>   the patch is:
> ##########################################
> --- report.py.bak    2007-05-25 13:36:27.000000000 -0400
> +++ report.py    2007-11-14 16:15:38.000000000 -0500
> @@ -438,6 +438,13 @@
>          if not report_args.has_key('USER'):
>              report_args['USER'] = req.authname
>
> +        if not report_args.has_key('TODAY'):
> +            report_args['TODAY'] =
> time.mktime(datetime.date.today().timetuple())
> +
>  +        if not report_args.has_key('NOW'):
> +            report_args['NOW'] = time.time()
> +
> +
>          return report_args
>
> ##########################################
> Here's the report I made:
>
> SELECT milestone as __group__,__style__, author, ticket,
>   newvalue as Work_added, time as time, _ord, ChargeNumber
> FROM(
>   SELECT '' as __style__,
>     author, cast(t.id as text) as ticket, milestone,
>     CAST(newvalue as REAL) as newvalue, ticket_change.time as time, 0 as
> _ord,
>     chargenumbers.value as ChargeNumber
>   FROM ticket_change
>   JOIN ticket t on t.id = ticket_change.ticket
>   LEFT JOIN ticket_custom as billable on billable.ticket = t.id
>     and billable.name = 'billable'
>   LEFT JOIN ticket_custom as chargenumbers on chargenumbers.ticket = t.id
>     and chargenumbers.name = 'chargenumber'
>   WHERE field = 'hours' and
>       ticket_change.time >= $TODAY
>       AND ticket_change.time < $NOW and
>     author = $USER
>
>   UNION
>
>   SELECT 'background-color:#DFE;' as __style__, author, NULL as ticket,
> milestone,
>     sum(CAST(newvalue as real)) as newvalue, NULL as time, 1 as _ord,
>     NULL as ChargeNumber
>   FROM ticket_change
>   JOIN ticket t on t.id = ticket_change.ticket
>   LEFT JOIN ticket_custom as billable on billable.ticket = t.id
>     and billable.name = 'billable'
>   WHERE field = 'hours' and
>       ticket_change.time >= $TODAY
>       AND ticket_change.time < $NOW and
>     author = $USER
>   GROUP By author
>
> )  as tbl
> ORDER BY author,  _ord ASC, time
>
>
>
>
>
>  >
>


-- 
Evolution: Taking care of those too stupid to take care of themselves.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to