Modify ↓
Opened 19 years ago
Closed 19 years ago
#2257 closed enhancement (worksforme)
Provide magic $NOW value to reports
Reported by: | Owned by: | daniel | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | report system | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I've added the $NOW magic variable to my reports:
# inside trac/ticket/report.py if not report_args.has_key('USER'): report_args['USER'] = req.authname + if not report_args.has_key('NOW'): + report_args['NOW'] = str(int(time.time()))
It's nice when making reports that show how long tickets have been open, using ($NOW - ticket.time) / 3600 to show hours.
Attachments (0)
Change History (2)
comment:1 by , 19 years ago
Type: | defect → enhancement |
---|
comment:2 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Date computations compared to the current time can already be done with the database's built-in date and time methods. For SQLite see http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
So for example to get the number of days a ticket has been open:
select julianday('now') - julianday(time, 'unixepoch') from ticket
Note:
See TracTickets
for help on using tickets.
Sorry, should have been an enhancement.