trac 的定制



trac 的定制

++到期 +++给 ticket 加上 due date

trac 默认的 ticket 是没有 due date 的,不过已经有插件帮我们做了这个事情.

关于 ticket due date 的讨论 http://trac.edgewall.org/wiki/TimeTracking http://trac.edgewall.org/ticket/1962

我最后选用了这个 http://trac-hacks.org/wiki/DateFieldPlugin

报表例子

官方例子

SELECT p.value AS __color__,
   id AS ticket, summary, owner, c.value AS due_date
  FROM ticket t, enum p, ticket_custom c
  WHERE t.id = c.ticket AND c.name = 'due_date'
AND p.name = t.priority AND p.type = 'priority'
  ORDER BY date(substr(c.value,7,4)||"-"||substr(c.value,1,2)||"-"||substr(c.value,4,2)),p.value

过期任务单

SELECT c.value AS due_date,
   p.value AS __color__,
   id AS ticket, summary, component, t.type AS type, 
   owner, status,
   changetime AS _changetime,
   reporter AS _reporter,
    time AS created,
  FROM ticket t,ticket_custom c
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  WHERE status <> 'closed'
  and  t.id = c.ticket AND c.name = 'due_date'
  and c.value<=CURRENT_TIMESTAMP
  ORDER BY CAST(p.value AS integer), milestone, t.type, time

未完成单子

SELECT c.value AS due_date,
   p.value AS __color__,
   (CASE status WHEN 'accepted' THEN 'Accepted' ELSE 'Owned' END) AS __group__,
   id AS ticket, summary, component,
   t.type AS type, priority, time AS created,
   changetime AS _changetime, description AS _description,
   reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  LEFT JOIN ticket_custom c ON c.ticket = t.id AND c.name = 'due_date'
  WHERE t.status <> 'closed' AND owner = $USER
  ORDER BY (status = 'accepted') DESC, CAST(p.value AS integer), milestone, t.type, time