| 1 | = 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. |
| 5 | |
| 6 | Note that when opening a report you are automatically redirected to the Trac report module. |
| 7 | |
| 8 | == Creating Reports |
| 9 | === Displaying a report on the review report page |
| 10 | For reports to show up on the review page you must add the following wiki comment to the reports description. |
| 11 | {{{ |
| 12 | {{{ |
| 13 | #!comment |
| 14 | codereview=1 |
| 15 | }}} |
| 16 | }}} |
| 17 | |
| 18 | Example report description: |
| 19 | {{{ |
| 20 | {{{ |
| 21 | #!comment |
| 22 | codereview=1 |
| 23 | }}} |
| 24 | * Show all files with status ''approved'' sorted by name. |
| 25 | |
| 26 | Open [/peerreviewreport Codereview report page]. |
| 27 | |
| 28 | }}} |
| 29 | === Provide links from report results |
| 30 | It is possible to directly link from report results to a referenced review or file. You need to set the {{{realm}}} column in the report as explained in [TracReports#Automaticallyformattedcolumns TracReports: Automatically formatted columns]. |
| 31 | |
| 32 | The following realms are available: |
| 33 | * {{{peerreview}}} |
| 34 | * {{{peerreviewfile}}} |
| 35 | |
| 36 | In this example in each result row {{{Id}}} directly links to the corresponding file page: |
| 37 | {{{#!sql |
| 38 | SELECT f.file_id AS id, f.review_id AS review_id, |
| 39 | f.path AS path, f.hash AS hash, |
| 40 | f.revision AS revision, f.status AS status, |
| 41 | 'peerreviewfile' AS _realm, |
| 42 | (SELECT COUNT(*) FROM peerreviewcomment AS c |
| 43 | WHERE f.file_id = c.file_id) AS comments |
| 44 | FROM peerreviewfile f |
| 45 | WHERE f.status = 'approved' |
| 46 | GROUP BY f.file_id |
| 47 | ORDER BY f.path, f.revision |
| 48 | }}} |