Changes between Version 1 and Version 2 of PeerReviewPlugin/Reports


Ignore:
Timestamp:
May 27, 2016, 7:29:16 AM (8 years ago)
Author:
Cinc-th
Comment:

Added example reports

Legend:

Unmodified
Added
Removed
Modified
  • PeerReviewPlugin/Reports

    v1 v2  
    11= Reports
    2 Instead of shipping it's own report module PeerReviewPlugin relies on Tracs reporting features by leveraging custom TracReports using data from PeerReviewPlugin.
    3 
    4 These custom reports can be accessed from the regular Trac report page but they are also shown on the report page for reviews.
     2Instead of shipping it's own report module PeerReviewPlugin relies on Tracs reporting features by leveraging custom TracReports using data from PeerReviewPlugin. These custom reports can be accessed from the regular Trac report page but they are also shown on the report page for reviews.
    53
    64Note that when opening a report you are automatically redirected to the Trac report module.
    75
     6There are no reports created during installation. You may use the ones shown below.
    87== Creating Reports
    98=== Displaying a report on the review report page
     
    4746ORDER BY f.path, f.revision
    4847}}}
     48== Example Reports
     49=== All reviews grouped by author
     50Description:
     51{{{
     52{{{
     53#!comment
     54codereview=1
     55}}}
     56Back to [/peerreviewreport Codereview reports].
     57}}}
     58
     59Query:
     60
     61{{{#!sql
     62SELECT r.owner AS __group__, r.review_id AS id,
     63       r.name AS name, r.owner AS owner,
     64       r.created AS created, r.project AS project,
     65       r.status AS status,
     66       (CASE WHEN r.parent_id  > 0 THEN r.parent_id ELSE NULL END) AS followup_from,
     67       (CASE r.status WHEN 'approved' THEN 2
     68        WHEN 'disapproved' THEN 1
     69        WHEN 'reviewed' THEN 4
     70        WHEN 'in-review' THEN 5 END) AS __color__,
     71       'peerreview' AS _realm
     72FROM peerreview as r
     73ORDER BY r.owner, r.review_id
     74}}}
     75
     76=== Approved files
     77Description:
     78{{{
     79{{{
     80#!comment
     81codereview=1
     82}}}
     83* Show all ''approved'' files sorted by name.
     84
     85Back to [/peerreviewreport Codereview reports].
     86}}}
     87
     88Query:
     89
     90{{{#!sql
     91SELECT f.file_id AS id, f.review_id AS review_id,
     92       f.path AS path, f.hash AS hash,
     93       f.revision AS revision, f.status AS status,
     94       'peerreviewfile' AS _realm,
     95       (SELECT COUNT(*) FROM peerreviewcomment AS c WHERE f.file_id = c.file_id) AS comments
     96FROM peerreviewfile f
     97WHERE f.status = 'approved'
     98GROUP BY f.file_id
     99ORDER BY f.path, f.revision
     100}}}
     101
     102=== All files with comments
     103Description:
     104{{{
     105{{{
     106#!comment
     107codereview=1
     108}}}
     109* Show all files with comments sorted by name.
     110
     111Back to [/peerreviewreport Codereview reports].
     112}}}
     113
     114Query:
     115
     116{{{#!sql
     117SELECT f.file_id AS id, f.review_id AS review_id,
     118       f.path AS path, f.revision AS revision,
     119       f.status AS status, COUNT(*) AS Comments,
     120       'peerreviewfile' AS _realm,
     121       (CASE f.status WHEN 'approved' THEN 2 WHEN 'disapproved' THEN 1 END) AS __color__
     122FROM peerreviewfile f
     123INNER JOIN peerreviewcomment AS c ON f.file_id = c.file_id
     124GROUP BY f.file_id
     125ORDER BY f.file_id, f.status, f.path, f.revision
     126}}}
     127
     128=== Files with comments - My reviews
     129Description:
     130{{{
     131{{{
     132#!comment
     133codereview=1
     134}}}
     135* Show all files with comments from reviews assigned to me sorted by name.
     136* Omit '''closed''' reviews
     137* Only new files or files which are in-progress. This means no files with status
     138 * '''approved'''
     139 * '''disapproved'''
     140* Mark files with unread comments
     141  [[BR]][[BR]]Note: the status ''read/unread'' is set for each user.
     142
     143Back to [/peerreviewreport Codereview reports].
     144}}}
     145
     146Query:
     147
     148{{{#!sql
     149SELECT f.file_id AS id, f.review_id AS 'review-Id',
     150       rev.name AS Reviewname, rev.owner AS reviewauthor,
     151       f.path AS path, f.revision AS revision,
     152       f.status AS filestatus, COUNT(*) AS comments,
     153       (SELECT COUNT(*) FROM peerreviewcomment AS c
     154        WHERE f.file_id = c.file_id) -
     155       (SELECT COUNT(*) FROM peerreviewdata AS d
     156        WHERE f.file_id = d.file_id AND owner = $USER) AS unread,
     157       'peerreviewfile' as _realm,
     158
     159       (CASE
     160        WHEN (SELECT COUNT(*) FROM peerreviewcomment AS c
     161        WHERE f.file_id = c.file_id) -
     162        (SELECT COUNT(*) FROM peerreviewdata AS d
     163        WHERE f.file_id = d.file_id AND owner = $USER) > 0 THEN 2 END) AS __color__
     164
     165FROM peerreviewfile AS f
     166INNER JOIN peerreviewcomment AS c ON f.file_id = c.file_id
     167INNER JOIN peerreview AS rev ON f.review_id = rev.review_id
     168WHERE (f.status IS NULL OR f.status NOT IN ('approved', 'disapproved'))
     169AND f.review_id in
     170(SELECT a.review_id FROM peerreviewer a JOIN peerreview r
     171ON a.review_id = r.review_id
     172WHERE a.reviewer = $USER
     173AND r.status IS NOT 'closed')
     174
     175GROUP BY f.file_id
     176ORDER BY f.file_id, f.status, f.path, f.revision
     177}}}