1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 20:10:55 +01:00

Allow ordering of badges by quality

Summary: Ref T9007

Test Plan: Navigate to "Advanced Search" in Badges, order by rarity, then by commonality. Rarest and most common badges should be ordered, respectively.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9007

Differential Revision: https://secure.phabricator.com/D15555
This commit is contained in:
lkassianik 2016-03-31 17:05:12 -07:00
parent bf1042c2f6
commit 7a6acd57fa

View file

@ -105,4 +105,36 @@ final class PhabricatorBadgesQuery
return 'PhabricatorBadgesApplication';
}
public function getBuiltinOrders() {
return array(
'quality' => array(
'vector' => array('quality', 'id'),
'name' => pht('Rarity (Rarest First)'),
),
'shoddiness' => array(
'vector' => array('-quality', '-id'),
'name' => pht('Rarity (Most Common First)'),
),
) + parent::getBuiltinOrders();
}
public function getOrderableColumns() {
return array(
'quality' => array(
'table' => $this->getPrimaryTableAlias(),
'column' => 'quality',
'reverse' => true,
'type' => 'int',
),
) + parent::getOrderableColumns();
}
protected function getPagingValueMap($cursor, array $keys) {
$badge = $this->loadCursorObject($cursor);
return array(
'quality' => $badge->getQuality(),
'id' => $badge->getID(),
);
}
}