Differential D14073 Diff 34742 src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php
| Show All 25 Lines | public function renderPropertyViewValue(array $handles) { | ||||
| $xactions = id(new DifferentialTransactionQuery()) | $xactions = id(new DifferentialTransactionQuery()) | ||||
| ->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
| ->withObjectPHIDs(array($diff_rev->getPHID())) | ->withObjectPHIDs(array($diff_rev->getPHID())) | ||||
| ->execute(); | ->execute(); | ||||
| $rejections = 0; | $rejections = 0; | ||||
| $comments = 0; | $comments = 0; | ||||
| $updates = 0; | $updates = 0; | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
| case PhabricatorTransactions::TYPE_COMMENT: | case PhabricatorTransactions::TYPE_COMMENT: | ||||
| $comments++; | $comments++; | ||||
| break; | break; | ||||
| case DifferentialTransaction::TYPE_UPDATE: | case DifferentialTransaction::TYPE_UPDATE: | ||||
| $updates++; | $updates++; | ||||
| break; | break; | ||||
| Show All 13 Lines | $points = | ||||
| self::UPDATES_WEIGHT * $updates; | self::UPDATES_WEIGHT * $updates; | ||||
| if ($points === 0) { | if ($points === 0) { | ||||
| $points = 0.15 * self::MAX_POINTS; | $points = 0.15 * self::MAX_POINTS; | ||||
| $blurb = pht('Silent diff'); | $blurb = pht('Silent diff'); | ||||
| } else { | } else { | ||||
| $parts = array(); | $parts = array(); | ||||
| if ($rejections) { | if ($rejections) { | ||||
| $parts[] = pht('%d rejection(s)', $rejections); | $parts[] = pht('%s rejection(s)', new PhutilNumber($rejections)); | ||||
| } | } | ||||
| if ($comments) { | if ($comments) { | ||||
| $parts[] = pht('%d comment(s)', $comments); | $parts[] = pht('%s comment(s)', new PhutilNumber($comments)); | ||||
| } | } | ||||
| if ($updates) { | if ($updates) { | ||||
| $parts[] = pht('%d update(s)', $updates); | $parts[] = pht('%s update(s)', new PhutilNumber($updates)); | ||||
| } | } | ||||
| if (count($parts) === 0) { | if (count($parts) === 0) { | ||||
| $blurb = ''; | $blurb = ''; | ||||
| } else if (count($parts) === 1) { | } else if (count($parts) === 1) { | ||||
| $blurb = head($parts); | $blurb = head($parts); | ||||
| } else { | } else { | ||||
| $last = array_pop($parts); | $last = array_pop($parts); | ||||
| Show All 12 Lines | |||||