Skip to content

Commit

Permalink
Minor: Admin: Update function definitions (return types and PHPDoc) i…
Browse files Browse the repository at this point in the history
…n statistics.lib.php
  • Loading branch information
ywarnier committed Oct 24, 2023
1 parent 2cfc81c commit 44b313e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions main/inc/lib/statistics.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ public static function buildJsChartData($all, $chartName)
}

/**
* It displays learnpath results from lti provider.
* Display learnpath results from lti provider.
*
* @return false|string
*/
Expand Down Expand Up @@ -1610,7 +1610,7 @@ public static function printLoginsByDate()
return $content;
}

public static function getBossTable($bossId)
public static function getBossTable($bossId): string
{
$students = UserManager::getUsersFollowedByStudentBoss($bossId);

Expand Down Expand Up @@ -1646,12 +1646,13 @@ public static function getBossTable($bossId)
}

/**
* @param string $startDate
* @param string $endDate
* Return a list of logins by date
* @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format
*
* @return array
*/
public static function getLoginsByDate($startDate, $endDate)
public static function getLoginsByDate($startDate, $endDate): array
{
/** @var DateTime $startDate */
$startDate = api_get_utc_datetime("$startDate 00:00:00");
Expand Down Expand Up @@ -1785,6 +1786,9 @@ public static function getSessionsByDuration(string $dateFrom, string $dateUntil
return $results;
}

/**
* Return duplicate users at a SortableTableFromArray object
*/
public static function returnDuplicatedUsersTable(array $additionalExtraFieldsInfo): SortableTableFromArray
{
$usersInfo = Statistics::getDuplicatedUsers($additionalExtraFieldsInfo);
Expand Down Expand Up @@ -1874,12 +1878,12 @@ function ($value) {
/**
* It gets lti learnpath results by date.
*
* @param $startDate
* @param $endDate
* @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format
*
* @return array
*/
private static function getLtiLearningPathByDate($startDate, $endDate)
private static function getLtiLearningPathByDate(string $startDate, string $endDate): array
{
/** @var DateTime $startDate */
$startDate = api_get_utc_datetime("$startDate 00:00:00");
Expand All @@ -1899,6 +1903,11 @@ private static function getLtiLearningPathByDate($startDate, $endDate)
return $result;
}

/**
* Get a list of users duplicated (firstname and lastname are both the same)
* @param array $additionalExtraFieldsInfo A list of extra fields we want to get in return, additional to the user details
* @return array
*/
private static function getDuplicatedUsers(array $additionalExtraFieldsInfo): array
{
$sql = "SELECT firstname, lastname, COUNT(*) as count
Expand Down

0 comments on commit 44b313e

Please sign in to comment.