Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit babd6f2

Browse files
committed
Tables are ordered from the latest to the earliest date
1 parent 05e1bc1 commit babd6f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Auth/Process/DatabaseCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function getLoginCountPerDay()
4141
$conn = $databaseConnector->getConnection();
4242
assert($conn != NULL);
4343
$table_name = $databaseConnector->getIdentityProvidersTableName();
44-
$stmt = $conn->prepare("SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year,month,day");
44+
$stmt = $conn->prepare("SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year DESC,month DESC,day DESC");
4545
$stmt->execute();
4646
$result = $stmt->get_result();
4747
while($row = $result->fetch_assoc()) {
@@ -57,7 +57,7 @@ public static function getLoginCountPerDeyPerService()
5757
$conn = $databaseConnector->getConnection();
5858
assert($conn != NULL);
5959
$table_name = $databaseConnector->getIdentityProvidersTableName();
60-
$stmt = $conn->prepare("SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name. " GROUP BY year, month, sourceIdp HAVING sourceIdp != ''");
60+
$stmt = $conn->prepare("SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name. " GROUP BY year, month, sourceIdp HAVING sourceIdp != '' ORDER BY year DESC, month DESC, count DESC");
6161
$stmt->execute();
6262
$result = $stmt->get_result();
6363
while($row = $result->fetch_assoc()) {
@@ -72,7 +72,7 @@ public static function getAccessToServicesPerMonth()
7272
$conn = $databaseConnector->getConnection();
7373
assert($conn != NULL);
7474
$table_name = $databaseConnector->getServiceProvidersTableName();
75-
$stmt = $conn->prepare("SELECT year, month, service, SUM(count) AS count FROM ".$table_name." GROUP BY year, month, service HAVING service != ''");
75+
$stmt = $conn->prepare("SELECT year, month, service, SUM(count) AS count FROM ".$table_name." GROUP BY year DESC, month DESC, service HAVING service != '' ORDER BY year DESC, month DESC, count DESC");
7676
$stmt->execute();
7777
$result = $stmt->get_result();
7878
while($row = $result->fetch_assoc()) {

0 commit comments

Comments
 (0)