mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +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:
parent
bf1042c2f6
commit
7a6acd57fa
1 changed files with 32 additions and 0 deletions
|
@ -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(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue