Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17942369
D18853.id45224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D18853.id45224.diff
View Options
diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php
--- a/src/applications/maniphest/controller/ManiphestReportController.php
+++ b/src/applications/maniphest/controller/ManiphestReportController.php
@@ -99,13 +99,66 @@
ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE,
));
+ // See PHI273. After the move to EditEngine, we no longer create a
+ // "status" transaction if a task is created directly into the default
+ // status. This likely impacted API/email tasks after 2016 and all other
+ // tasks after late 2017. Until Facts can fix this properly, use the
+ // task creation dates to generate synthetic transactions which look like
+ // the older transactions that this page expects.
+
+ $default_status = ManiphestTaskStatus::getDefaultStatus();
+ $duplicate_status = ManiphestTaskStatus::getDuplicateStatus();
+
+ // Build synthetic transactions which take status from `null` to the
+ // default value.
+ $create_rows = queryfx_all(
+ $conn,
+ 'SELECT dateCreated FROM %T',
+ id(new ManiphestTask())->getTableName());
+ foreach ($create_rows as $key => $create_row) {
+ $create_rows[$key] = array(
+ 'transactionType' => 'status',
+ 'oldValue' => null,
+ 'newValue' => $default_status,
+ 'dateCreated' => $create_row['dateCreated'],
+ );
+ }
+
+ // Remove any actual legacy status transactions which take status from
+ // `null` to any open status.
+ foreach ($data as $key => $row) {
+ if ($row['transactionType'] != 'status') {
+ continue;
+ }
+
+ $oldv = trim($row['oldValue'], '"');
+ $newv = trim($row['oldValue'], '"');
+
+ // If this is a status change, preserve it.
+ if ($oldv != 'null') {
+ continue;
+ }
+
+ // If this task was created directly into a closed status, preserve
+ // the transaction.
+ if (!ManiphestTaskStatus::isOpenStatus($newv)) {
+ continue;
+ }
+
+ // If this is a legacy "create" transaction, discard it in favor of the
+ // synthetic one.
+ unset($data[$key]);
+ }
+
+ // Merge the synthetic rows into the real transactions.
+ $data = array_merge($create_rows, $data);
+ $data = array_values($data);
+
$stats = array();
$day_buckets = array();
$open_tasks = array();
- $default_status = ManiphestTaskStatus::getDefaultStatus();
- $duplicate_status = ManiphestTaskStatus::getDuplicateStatus();
foreach ($data as $key => $row) {
switch ($row['transactionType']) {
case ManiphestTaskStatusTransaction::TRANSACTIONTYPE:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 1, 6:42 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8331391
Default Alt Text
D18853.id45224.diff (2 KB)
Attached To
Mode
D18853: Pile more atrocities onto the Maniphest burnup report
Attached
Detach File
Event Timeline
Log In to Comment