Edgewall Software

Changes between Version 4 and Version 5 of CookBook/Configuration/Reports


Ignore:
Timestamp:
Apr 22, 2010, 9:48:23 AM (14 years ago)
Author:
Remy Blank
Comment:

Added "interesting" reports from t.e.o.

Legend:

Unmodified
Added
Removed
Modified
  • CookBook/Configuration/Reports

    v4 v5  
    55This page contains SQL for reports that may be of interest to many users.
    66
    7 == User Report ==
     7== Ticket reports ==
     8
     9=== User Report ===
    810
    911When one visits a Trac system as a user of a product and not as a developer of the product, one often wants to search for those tickets of personal interest.  Such tickets could be defined as those tickets where the user is the Reporter, in the CC or additionally as a commenter.
     
    7476}}}
    7577
     78
     79=== Popular tickets - to do ===
     80
     81This lists tickets that are on the TODO list for a long time.
     82
     83The criteria for inclusion is that the feature request or bug report is that '''at least 10 different people participated to the ticket activity'''.
     84
     85Tickets are ordered by ''popularity'', defined as the amount of activity on a ticket over time (using a secret formula taking into account the number of participants in the discussion, the number of people on CC:, ...)
     86
     87This is report {32} on this site.
     88{{{#!sql
     89SELECT p.value AS __color__,
     90  (SELECT
     91    ROUND(( (tc.author_cnt + tc.change_cnt * 0.5 + LENGTH(t.cc) * 1.5)
     92             / (delta/86400.0)
     93          ) * 10.0
     94         ) / 10.0
     95   FROM (SELECT ((time.now * 1000000 - changetime) / 1000000.0) AS delta
     96        ) AS ct
     97  ) AS Popularity,
     98  t.type,
     99  id AS ticket, summary,
     100  component,
     101  version,
     102  time as created
     103FROM ticket t LEFT JOIN
     104   (SELECT ticket, count(distinct author) as author_cnt,
     105          count(*) as change_cnt
     106    FROM ticket_change
     107    WHERE field = 'comment' GROUP BY ticket) tc ON (t.id = tc.ticket),
     108   enum p,
     109   (SELECT extract(epoch from current_timestamp) as now) time
     110WHERE t.status != 'closed'
     111  -- AND time.now - t.time > 86400.0 * 30 * 2
     112  -- well, the above was not really needed as they are all older than 1 year...
     113  AND tc.author_cnt >= 10
     114  AND p.name = t.priority AND p.type = 'priority'
     115ORDER BY
     116 ( (tc.author_cnt + tc.change_cnt * 0.5 + LENGTH(t.cc) * 1.5)
     117    / ((time.now * 1000000 - changetime) / 1000000.0) ) desc, 
     118 p.value, t.severity, time
     119
     120}}}
     121
     122
     123=== Popular tickets - done ===
     124
     125In order to balance report {32} (tickets that are on the TODO list for a long time), we can also show that we managed to implement popular feature requests over time ;-)
     126
     127The criteria for inclusion for the feature request or bug report is that '''at least 10 different people participated to the ticket activity'''.
     128
     129Tickets are ordered by ''popularity'', defined as the amount of activity on a ticket over time.
     130
     131This is report {33} on this site.
     132{{{#!sql
     133SELECT p.value AS __color__,
     134  (SELECT
     135    ROUND(( (tc.author_cnt + tc.change_cnt * 0.5 + LENGTH(COALESCE(t.cc, '')) * 1.5)
     136             / (delta/86400.0)
     137          ) * 10.0
     138         ) / 10.0
     139   FROM (SELECT ((time.now * 1000000 - changetime) / 1000000.0) AS delta
     140        ) AS ct
     141  ) AS Popularity,
     142 --
     143 --  ROUND(((tc.author_cnt + tc.change_cnt * 0.5 + LENGTH(COALESCE(t.cc, '')) * 1.5)
     144 -- / ((time.now - t.time)/(86400.0 * 30))) * 10.0) / 10.0 AS Popularity,
     145 --
     146  t.type,
     147  id AS ticket, summary, component,
     148  milestone, version,
     149  time as created
     150FROM ticket t LEFT JOIN
     151   (SELECT ticket, count(distinct author) as author_cnt,
     152          count(*) as change_cnt
     153    FROM ticket_change
     154    WHERE field = 'comment' GROUP BY ticket) tc ON (t.id = tc.ticket),
     155   enum p,
     156   (SELECT extract(epoch from current_timestamp) as now) time
     157WHERE t.status = 'closed' AND t.resolution = 'fixed'
     158  -- AND time.now - t.time > 86400.0 * 30 * 2
     159  -- well, the above was not really needed as they are all older than 1 year...
     160  AND tc.author_cnt >= 10
     161  AND p.name = t.priority AND p.type = 'priority'
     162ORDER BY
     163 ( (tc.author_cnt + tc.change_cnt * 0.5 + LENGTH(COALESCE(t.cc, '')) * 1.5)
     164    / ((time.now * 1000000 - changetime) / 1000000.0) ) desc, 
     165 p.value, t.severity, time
     166}}}
     167
     168
     169=== Popular Voted Tickets ===
     170
     171Tickets ordered by number of votes (> 1).
     172
     173This is report {34} on this site.
     174{{{#!sql
     175SELECT p.value AS __color__,
     176   t.type AS type, id AS ticket, sum(v.vote) as votes, summary, component, version,
     177milestone,
     178   time AS created,
     179   changetime AS _changetime, description AS _description,
     180   reporter AS _reporter
     181  FROM ticket t, enum p, votes v
     182  WHERE status <> 'closed'
     183AND p.name = t.priority AND p.type = 'priority'
     184AND v.resource = 'ticket/' || id
     185GROUP BY id, summary, component, version, milestone, t.type, owner,
     186time,
     187  changetime, description, reporter, p.value, status
     188HAVING sum(v.vote) > 1
     189 ORDER BY votes DESC, milestone, t.type, time
     190}}}
     191
     192
     193=== Overview for next Milestones ===
     194
     195Show count of opened tickets by type for the next Milestones.
     196
     197This is report {37} on this site.
     198{{{#!sql
     199SELECT
     200 name AS id, 'milestone' AS _realm,
     201 (SELECT count(*) FROM ticket
     202  WHERE milestone=m.name AND type='enhancement' AND status != 'closed') as Enhancements,
     203 (SELECT count(*) FROM ticket
     204  WHERE milestone=m.name AND type='defect' AND status != 'closed') as Defects,
     205 (SELECT count(*) FROM ticket
     206  WHERE milestone=m.name AND type='task' AND status != 'closed') as Tasks
     207FROM milestone AS m
     208WHERE completed = 0
     209ORDER BY name
     210}}}
     211
     212
    76213== Non Ticket Reports ==
    77214
     
    79216
    80217=== User Changesets ===
     218
    81219The follow report will lists all of the changes for the current user, or add "?USER=''user''" to the end of the URL to report on another user.
    82220{{{
     
    105243  ORDER BY time DESC
    106244}}}
     245
     246
    107247=== Wiki Changes ===
     248
    108249This reports the wiki pages ever modified by the current user, or add "?USER=''user''" to the end of the URL to report on another user.  Version is the highest version that the user modified.
    109250{{{