mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-10 03:14:48 +01:00
Summary: Implement basic token leader board. No pagination yet. Test Plan: Assign some tasks tokens and check that they are displayed properly. Reviewers: epriestley CC: aran, Korvin, chad Maniphest Tasks: T2689 Differential Revision: https://secure.phabricator.com/D5379
35 lines
823 B
PHP
35 lines
823 B
PHP
<?php
|
|
|
|
final class PhabricatorTokenReceiverQuery
|
|
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
|
|
private $tokenCounts;
|
|
|
|
protected function loadPage() {
|
|
$table = new PhabricatorTokenCount();
|
|
$conn_r = $table->establishConnection('r');
|
|
|
|
$rows = queryfx_all(
|
|
$conn_r,
|
|
'SELECT objectPHID, tokenCount FROM %T ORDER BY tokenCount DESC',
|
|
$table->getTableName());
|
|
|
|
$this->tokenCounts = ipull($rows, 'tokenCount', 'objectPHID');
|
|
return ipull($rows, 'objectPHID');
|
|
}
|
|
|
|
public function willFilterPage(array $phids) {
|
|
if (!$phids) {
|
|
return array();
|
|
}
|
|
$objects = id(new PhabricatorObjectHandleData($phids))
|
|
->setViewer($this->getViewer())
|
|
->loadObjects();
|
|
return $objects;
|
|
}
|
|
|
|
public function getTokenCounts() {
|
|
return $this->tokenCounts;
|
|
}
|
|
|
|
}
|