How to create a report closed on a specific day in Trac

I want to create a report that lists all the tickets that were closed for a certain period of time.

Pseudocode will look like

SELECT * FROM tickets
WHERE closed AND date_closed = 'january 2009'

The part I can not solve is date_closed = 'january 2009'.

Is there a way to do this in Trac?

I am not interested in the specific SQL syntax; I myself can write temporary restrictions. I am not sure if this is a Trac db structure.

+3
source share
3 answers
SELECT DISTINCT ticket.* FROM ticket, ticket_change
 WHERE ticket.id = ticket_change.ticket
   AND ticket_change.field = 'status'
   AND ticket_change.newvalue = 'closed'
   AND strftime('%m', ticket_change.time, 'unixepoch') = '01';

If you also know the year, instead of strftime youd, it is better to use an expression like vartecs:

SELECT DISTINCT ticket.* FROM ticket, ticket_change
 WHERE ticket.id = ticket_change.ticket
   AND ticket_change.field = 'status'
   AND ticket_change.newvalue = 'closed'
   AND date(ticket_change.time,'unixepoch') 
       BETWEEN date('2009-01-01','start of month') 
           AND date('2009-01-01','start of month','+1 month','-1 day')
+2
source
SELECT * FROM ticket
WHERE status='closed' 
  AND date(changetime,'unixepoch') 
      BETWEEN date('YYYY-MM-DD') /* <- here goes your start date */
          AND date('YYYY-MM-DD') /* <- here goes your end date */

If you need a specific month:

SELECT * FROM ticket
WHERE status='closed' 
  AND date(changetime,'unixepoch') 
      BETWEEN date('2009-01-01','start of month') 
          AND date('2009-01-01','start of month','+1 month','-1 day') 

date('2009-01-01','start of month') - , , date('2009-01-01','start of month','+1 month','-1 day') - .

+3

, , :

CREATE TABLE ticket_change ( 
    ticket   INTEGER,
    time     INTEGER,
    author   TEXT,
    field    TEXT,
    oldvalue TEXT,
    newvalue TEXT,
    UNIQUE ( ticket, time, field ) 
);
0

Source: https://habr.com/ru/post/1703805/


All Articles