Commit 3be3f815 authored by Hugh Davenport's avatar Hugh Davenport
Browse files

Add more statitics to institution stats



- Number of logged in users in last week

Change-Id: Ibaf27bef18fdabf984d2d157c8c53cbb6e5c626a
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent 2e111949
......@@ -281,6 +281,23 @@ function institution_registration_data() {
$inst_data['count_interaction_forum_post'] = count_records_select('interaction_forum_post',
'poster IN (' . join(',', array_fill(0, count($members), '?')) . ')',
$members);
if (is_postgres()) {
$weekago = "CURRENT_DATE - INTERVAL '1 week'";
$thisweeksql = "(lastaccess > $weekago)::int";
}
else {
$weekago = 'CURRENT_DATE - INTERVAL 1 WEEK';
$thisweeksql = "lastaccess > $weekago";
}
if ($data = get_record_sql('SELECT SUM(' . $thisweeksql . ') AS sum
FROM {usr} u
WHERE u.id IN (' . join(',', array_fill(0, count($members), '?')) . ')',
$members)) {
$inst_data['usersloggedin'] = $data->sum;
}
else {
$inst_data['usersloggedin'] = 0;
}
$data_to_store[$institution] = $inst_data;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment