Skip to content

Commit

Permalink
feat: Add a historical report for lab usage per learner, per month
Browse files Browse the repository at this point in the history
Enable a lab report that aggregates lab usage per learner per month,
across all courses which that learner is enrolled in.
  • Loading branch information
fghaas committed Nov 4, 2024
1 parent 6ae2511 commit 5e9b478
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
_enrollment_report_pass_historical_filename: "pass_report_historical_{{ _enrollment_report_end_date }}{{ _enrollment_report_file_suffix }}"
_enrollment_report_percent_historical_filename: "percent_report_historical_{{ _enrollment_report_end_date }}{{ _enrollment_report_file_suffix }}"
_enrollment_report_lab_historical_filename: "lab_report_historical_{{ _enrollment_report_end_date }}{{ _enrollment_report_file_suffix }}"
_enrollment_report_lab_historical_by_learner_filename: "lab_report_historical_by_learner{{ _enrollment_report_end_date }}{{ _enrollment_report_file_suffix }}"

- name: set output file paths
set_fact:
Expand All @@ -59,6 +60,7 @@
_enrollment_report_pass_historical_outfile: "{{ _enrollment_report_directory.path }}/{{ _enrollment_report_pass_historical_filename }}"
_enrollment_report_percent_historical_outfile: "{{ _enrollment_report_directory.path }}/{{ _enrollment_report_percent_historical_filename }}"
_enrollment_report_lab_historical_outfile: "{{ _enrollment_report_directory.path }}/{{ _enrollment_report_lab_historical_filename }}"
_enrollment_report_lab_historical_by_learner_outfile: "{{ _enrollment_report_directory.path }}/{{ _enrollment_report_lab_historical_by_learner_filename }}"

- name: create tempfile for enrollment report SQL
tempfile:
Expand Down Expand Up @@ -144,18 +146,30 @@
src: lab-report.sql.j2
mode: 0644

- name: create tempfile for historical "lab" report SQL
- name: create tempfile for "historical lab" report SQL
tempfile:
state: file
suffix: .sql
register: _enrollment_report_lab_historical_sql

- name: populate historical "lab" report SQL
- name: populate "historical lab" report SQL
template:
dest: "{{ _enrollment_report_lab_historical_sql.path }}"
src: lab-report-historical.sql.j2
mode: 0644

- name: create tempfile for "historical lab by learner" report SQL
tempfile:
state: file
suffix: .sql
register: _enrollment_report_lab_historical_by_learner_sql

- name: populate "historical_by lab by learner" report SQL
template:
dest: "{{ _enrollment_report_lab_historical_by_learner_sql.path }}"
src: lab-report-historical-by-learner.sql.j2
mode: 0644

- name: execute scripts
become: true
become_user: root
Expand All @@ -177,6 +191,8 @@
out: "{{ _enrollment_report_percent_historical_outfile }}"
- in: "{{ _enrollment_report_lab_historical_sql.path }}"
out: "{{ _enrollment_report_lab_historical_outfile }}"
- in: "{{ _enrollment_report_lab_historical_by_learner_sql.path }}"
out: "{{ _enrollment_report_lab_historical_by_learner_outfile }}"

- name: ensure output directory exists
file:
Expand All @@ -202,6 +218,7 @@
- "{{ enrollment_report_path }}/{{ _enrollment_report_pass_historical_filename }}"
- "{{ enrollment_report_path }}/{{ _enrollment_report_percent_historical_filename }}"
- "{{ enrollment_report_path }}/{{ _enrollment_report_lab_historical_filename }}"
- "{{ enrollment_report_path }}/{{ _enrollment_report_lab_historical_by_learner_filename }}"
when: enrollment_report_mail_enable

- name: send out enrollment reports
Expand Down Expand Up @@ -240,3 +257,4 @@
- "{{ _enrollment_report_pass_historical_sql.path }}"
- "{{ _enrollment_report_percent_historical_sql.path }}"
- "{{ _enrollment_report_lab_historical_sql.path }}"
- "{{ _enrollment_report_lab_historical_by_learner_sql.path }}"

0 comments on commit 5e9b478

Please sign in to comment.