1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Paginate token leader board.

Summary: Add pagination to leader board. Add key on token count in db.

Test Plan: Set page size to 1 and give tokens to two tasks.

Reviewers: epriestley, AnhNhan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5513
This commit is contained in:
Bryan Cuccioli 2013-04-01 08:15:23 -07:00 committed by epriestley
parent cdcd49e4ee
commit 2334f63c2c
3 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_token.token_count
ADD KEY `key_count` (tokenCount);

View file

@ -6,11 +6,13 @@ final class PhabricatorTokenLeaderController
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
$user = $request->getUser(); $user = $request->getUser();
$pager = id(new AphrontCursorPagerView())
->readFromRequest($request); $pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'page');
$pager->setOffset($request->getInt('page'));
$query = id(new PhabricatorTokenReceiverQuery()); $query = id(new PhabricatorTokenReceiverQuery());
$objects = $query->setViewer($user)->execute(); $objects = $query->setViewer($user)->executeWithOffsetPager($pager);
$counts = $query->getTokenCounts(); $counts = $query->getTokenCounts();
$handles = array(); $handles = array();

View file

@ -1202,6 +1202,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql', 'type' => 'sql',
'name' => $this->getPatchPath('20130317.phrictionedge.sql'), 'name' => $this->getPatchPath('20130317.phrictionedge.sql'),
), ),
'20130321.token.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130321.token.sql'),
),
'20130310.xactionmeta.sql' => array( '20130310.xactionmeta.sql' => array(
'type' => 'sql', 'type' => 'sql',
'name' => $this->getPatchPath('20130310.xactionmeta.sql'), 'name' => $this->getPatchPath('20130310.xactionmeta.sql'),