trac チケット表示のクエリサンプル
2011/07/08
チケット表示を少しカスタマイズ。クエリのサンプル集。
デフォルト
デフォルトの内容は、「Trac 再インストール(削除~インストール)」の中の「「View Ticlets」の各項目のクエリ」にあります。
Priorityを追加
Active Ticketsの「1」~「3」に「Priority」を追加。
SELECT ~
reporter AS _reporter
FROM ~
↓↓↓
SELECT ~
reporter AS _reporter, priority
FROM ~
reporter AS _reporter
FROM ~
↓↓↓
SELECT ~
reporter AS _reporter, priority
FROM ~
Priority別の未作業チケット
- SELECT p.value AS __color__,
- priority AS __group__,
- id AS ticket, summary, component, version, t.type AS type,
- owner, status,
- 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'
- WHERE status <> 'closed'
- ORDER BY (priority IS NULL),priority, CAST(p.value AS int), t.type, time
作業完了済みのチケット(日付逆順)
- SELECT p.value AS __color__,
- (CASE status
- WHEN 'closed' THEN 'color: #777; background: #ddd; border-color: #ccc;'
- ELSE
- (CASE owner WHEN $USER THEN 'font-weight: bold' END)
- END) AS __style__,
- id AS ticket, summary, component,
- resolution,version, owner,
- changetime AS modified
- FROM ticket t
- LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
- where status = 'closed'
- order by changetime desc
作業完了(日付逆順)でResolutions別
- SELECT
- resolution AS __group__,
- id AS ticket, summary, component, version, owner, changetime AS modified
- FROM ticket t
- LEFT JOIN enum p ON p.name = t.priority
- where status = 'closed'
- order by resolution,changetime desc
未作業のpriority別で最新順
- SELECT p.value AS __color__,
- priority AS __group__,
- id AS ticket, summary, component, version, t.type AS type,
- owner, status, 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'
- WHERE status <> 'closed'
- ORDER BY (priority IS NULL),priority, time desc
未作業のtype別で最新順
- SELECT p.value AS __color__,
- t.type AS __group__,
- id AS ticket, summary, component, version, priority,
- owner, status, 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'
- WHERE status <> 'closed'
- ORDER BY (t.type IS NULL), t.type, time desc