-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a historical report for lab usage per learner, per month
Enable a lab report that aggregates lab usage per learner per month, across all courses which that learner is enrolled in.
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- -*- mode: sql; -*- | ||
-- vim: ft=sql | ||
SELECT | ||
u.email, | ||
YEAR(sl.suspend_timestamp) AS 'year', | ||
MONTH(sl.suspend_timestamp) AS 'month', | ||
SUM(TIMESTAMPDIFF(SECOND, | ||
sl.launch_timestamp, | ||
sl.suspend_timestamp)) AS lab_seconds | ||
FROM hastexo_stacklog AS sl | ||
INNER JOIN hastexo_stack AS s ON sl.stack_id=s.id | ||
INNER JOIN auth_user u ON s.learner_id=u.id | ||
WHERE | ||
sl.status='SUSPEND_COMPLETE' | ||
AND sl.suspend_timestamp<='{{ _enrollment_report_end_datetime }}' | ||
GROUP BY | ||
u.email, | ||
year, | ||
month | ||
ORDER BY | ||
year, | ||
month, | ||
u.email | ||
; |