Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/tracker/controllers/components/ApiComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ public function aggregatemetricsUpdate($args)
* @return AggregateMetricSpecDao aggregate metric spec DAO
* @throws Exception
*/
private function _loadAggregateMetricSpec($userDao, $aggregateMetricSpecId, $policy = MIDAS_POLICY_READ) {
private function _loadAggregateMetricSpec($userDao, $aggregateMetricSpecId, $policy = MIDAS_POLICY_READ)
{
/** @var Tracker_AggregateMetricSpecModel $aggregateMetricSpecModel */
$aggregateMetricSpecModel = MidasLoader::loadModel('AggregateMetricSpec', 'tracker');
/** @var Tracker_AggregateMetricSpecDao $aggregateMetricSpecDao */
Expand Down
15 changes: 11 additions & 4 deletions modules/tracker/models/pdo/AggregateMetricSpecModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Tracker_AggregateMetricSpecModel extends Tracker_AggregateMetricSpecModelB
* @param UserDao $userDao user DAO
* @return bool true if the notification could be created, false otherwise
*/
public function createUserNotification($aggregateMetricSpecDao, $userDao) {
public function createUserNotification($aggregateMetricSpecDao, $userDao)
{
if (is_null($aggregateMetricSpecDao) || $aggregateMetricSpecDao === false) {
return false;
}
Expand All @@ -52,6 +53,7 @@ public function createUserNotification($aggregateMetricSpecDao, $userDao) {
'user_id' => $userDao->getUserId(),
);
$this->database->getdb()->insert('tracker_user2aggregate_metric_spec', $data);

return true;
}
}
Expand All @@ -65,7 +67,8 @@ public function createUserNotification($aggregateMetricSpecDao, $userDao) {
* notification does not exist for this user and aggregate metric spec upon
* returning, false otherwise
*/
public function deleteUserNotification($aggregateMetricSpecDao, $userDao) {
public function deleteUserNotification($aggregateMetricSpecDao, $userDao)
{
if (is_null($aggregateMetricSpecDao) || $aggregateMetricSpecDao === false) {
return false;
}
Expand All @@ -76,6 +79,7 @@ public function deleteUserNotification($aggregateMetricSpecDao, $userDao) {
'aggregate_metric_spec_id = ?' => $aggregateMetricSpecDao->getAggregateMetricSpecId(),
'user_id = ?' => $userDao->getUserId(),
));

return true;
}

Expand All @@ -86,7 +90,8 @@ public function deleteUserNotification($aggregateMetricSpecDao, $userDao) {
* @return false|array of UserDao for all users with notification on the passed in $aggregateMetricSpecDao,
* or false if the passed in spec is invalid
*/
public function getAllNotifiedUsers($aggregateMetricSpecDao) {
public function getAllNotifiedUsers($aggregateMetricSpecDao)
{
if (is_null($aggregateMetricSpecDao) || $aggregateMetricSpecDao === false) {
return false;
}
Expand All @@ -102,6 +107,7 @@ public function getAllNotifiedUsers($aggregateMetricSpecDao) {
foreach ($rows as $row) {
$userDaos[] = $userModel->load($row['user_id']);
}

return $userDaos;
}

Expand All @@ -111,7 +117,8 @@ public function getAllNotifiedUsers($aggregateMetricSpecDao) {
*
* @param Tracker_AggregateMetricSpecDao $aggregateMetricSpecDao aggregateMetricSpec DAO
*/
public function delete($aggregateMetricSpecDao) {
public function delete($aggregateMetricSpecDao)
{
if (is_null($aggregateMetricSpecDao) || $aggregateMetricSpecDao === false) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/tracker/tests/controllers/ApiComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public function testAggregatemetricspecNotificationEndpoints()
$expectedUserIds[$notifiedUser->user_id] = true;
}
/** @var int $expectedUserId */
/** @var boolean $found */
/** @var bool $found */
foreach ($expectedUserIds as $expectedUserId => $found) {
$this->assertTrue($found);
}
Expand Down Expand Up @@ -515,7 +515,7 @@ public function testAggregatemetricspecNotificationEndpoints()
$expectedUserIds[$notifiedUser->user_id] = true;
}
/** @var int $expectedUserId */
/** @var boolean $found */
/** @var bool $found */
foreach ($expectedUserIds as $expectedUserId => $found) {
$this->assertTrue($found);
}
Expand Down