mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Implemented showing the number of objects tracked as application status.
Summary: Implementing that TODO where we want to show the current number of objects being tracked by a user on the application icon so that they're aware of any timers that are running. Depends on D5479 Test Plan: Apply this patch and track a Maniphest task. The counter should show the number of objects you are tracking in the navigation pane of the main screen Reviewers: epriestley CC: aran, Korvin Maniphest Tasks: T2857 Differential Revision: https://secure.phabricator.com/D5480
This commit is contained in:
parent
4a5dfd3819
commit
c3c88fd40c
2 changed files with 21 additions and 16 deletions
|
@ -45,27 +45,16 @@ final class PhabricatorApplicationPhrequent extends PhabricatorApplication {
|
|||
public function loadStatus(PhabricatorUser $user) {
|
||||
$status = array();
|
||||
|
||||
// TODO: Show number of timers that are currently
|
||||
// running for a user.
|
||||
// Show number of objects that are currently
|
||||
// being tracked for a user.
|
||||
|
||||
/*
|
||||
|
||||
$query = id(new ManiphestTaskQuery())
|
||||
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
|
||||
->withOwners(array($user->getPHID()))
|
||||
->setLimit(1)
|
||||
->setCalculateRows(true);
|
||||
$query->execute();
|
||||
|
||||
$count = $query->getRowCount();
|
||||
$type = PhabricatorApplicationStatusView::TYPE_WARNING;
|
||||
$count = PhrequentUserTimeQuery::getUserTotalObjectsTracked($user);
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Assigned Task(s)', $count))
|
||||
->setText(pht('%d Object(s) Tracked', $count))
|
||||
->setCount($count);
|
||||
|
||||
*/
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,22 @@ final class PhrequentUserTimeQuery extends PhabricatorOffsetPagedQuery {
|
|||
|
||||
/* -( Helper Functions ) --------------------------------------------------- */
|
||||
|
||||
public static function getUserTotalObjectsTracked(
|
||||
PhabricatorUser $user) {
|
||||
|
||||
$usertime_dao = new PhrequentUserTime();
|
||||
$conn = $usertime_dao->establishConnection('r');
|
||||
|
||||
$count = queryfx_one(
|
||||
$conn,
|
||||
'SELECT COUNT(usertime.id) N FROM %T usertime '.
|
||||
'WHERE usertime.userPHID = %s '.
|
||||
'AND usertime.dateEnded IS NULL',
|
||||
$usertime_dao->getTableName(),
|
||||
$user->getPHID());
|
||||
return $count['N'];
|
||||
}
|
||||
|
||||
public static function isUserTrackingObject(
|
||||
PhabricatorUser $user,
|
||||
$phid) {
|
||||
|
|
Loading…
Reference in a new issue