@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Correct an issue where Maniphest's awful legacy "reports" UI was extra broken on merges

Summary:
See PHI66. See that issue for context. This UI is bad broken legacy junk, but was especially broken when reporting merges.

These do not currently generate a "status" transaction, so they were never counted as task closures. Pretend they're normal closures.

This is still wrong, but should be much closer to the real numbers. Specifically, if you merge a closed task into another task, it will incorrectly be counted as an extra close. This could result in negative tasks, but the numbers should be much closer to reality than they are today even so.

The "Facts" application (T1562) is the real pathway forward here in the longer term.

Test Plan:
- Moved my `maniphest_transactions` table aside with `RENAME TABLE ...`.
- Created a new empty table with `CREATE TABLE ... LIKE ...`.
- Reloaded reports UI, saw empty chart.
- Created, closed, and reopened tasks while reloading the chart, saw accurate reporting.
- Merged an open task into another task, saw bad reporting.
- Applied patch, saw the right chart again.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18601

+24 -7
+24 -7
src/applications/maniphest/controller/ManiphestReportController.php
··· 88 88 89 89 $data = queryfx_all( 90 90 $conn, 91 - 'SELECT x.oldValue, x.newValue, x.dateCreated FROM %T x %Q 92 - WHERE transactionType = %s 91 + 'SELECT x.transactionType, x.oldValue, x.newValue, x.dateCreated 92 + FROM %T x %Q 93 + WHERE transactionType IN (%Ls) 93 94 ORDER BY x.dateCreated ASC', 94 95 $table->getTableName(), 95 96 $joins, 96 - ManiphestTaskStatusTransaction::TRANSACTIONTYPE); 97 + array( 98 + ManiphestTaskStatusTransaction::TRANSACTIONTYPE, 99 + ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE, 100 + )); 97 101 98 102 $stats = array(); 99 103 $day_buckets = array(); 100 104 101 105 $open_tasks = array(); 102 106 107 + $default_status = ManiphestTaskStatus::getDefaultStatus(); 108 + $duplicate_status = ManiphestTaskStatus::getDuplicateStatus(); 103 109 foreach ($data as $key => $row) { 104 - 105 - // NOTE: Hack to avoid json_decode(). 106 - $oldv = trim($row['oldValue'], '"'); 107 - $newv = trim($row['newValue'], '"'); 110 + switch ($row['transactionType']) { 111 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 112 + // NOTE: Hack to avoid json_decode(). 113 + $oldv = trim($row['oldValue'], '"'); 114 + $newv = trim($row['newValue'], '"'); 115 + break; 116 + case ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE: 117 + // NOTE: Merging a task does not generate a "status" transaction. 118 + // We pretend it did. Note that this is not always accurate: it is 119 + // possble to merge a task which was previously closed, but this 120 + // fake transaction always counts a merge as a closure. 121 + $oldv = $default_status; 122 + $newv = $duplicate_status; 123 + break; 124 + } 108 125 109 126 if ($oldv == 'null') { 110 127 $old_is_open = false;