Skip to content

Commit 0cc7ba5

Browse files
committed
Fix for #199
1 parent 7c372c0 commit 0cc7ba5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

classes/metric/online_users_metric.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ public function generate_metric_items($backwardperiod, $finishtime = null, ?\pro
106106
];
107107

108108
$interval = $secondsinterval[$frequency];
109-
$sql = 'WITH user_data AS (
109+
$sql = "WITH user_data AS (
110110
SELECT floor(timecreated / :interval ) * :intervaldup AS time, userid
111111
FROM {logstore_standard_log}
112112
WHERE timecreated >= :starttime
113113
AND timecreated <= :finishtime
114-
AND action = "loggedin"
114+
AND action = 'loggedin'
115115
)
116116
117117
SELECT user_data.time as time, COUNT(DISTINCT(user_data.userid)) as value
118118
FROM user_data
119119
GROUP BY user_data.time
120-
ORDER BY user_data.time ASC';
120+
ORDER BY user_data.time ASC";
121121
$rs = $DB->get_recordset_sql($sql,
122122
['interval' => $interval, 'intervaldup' => $interval, 'starttime' => $starttime, 'finishtime' => $finishtime]);
123123
$metricitems = [];

db/install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
* Function to install tool_cloudmetrics.
2828
*/
2929
function xmldb_tool_cloudmetrics_install() {
30+
if (PHPUNIT_TEST) {
31+
return;
32+
}
3033
$backfilltask = new \tool_cloudmetrics\task\autobackfill_metrics_task();
3134
\core\task\manager::queue_adhoc_task($backfilltask);
3235
}

0 commit comments

Comments
 (0)