From 5e9b478feba87ee732093da65ab3e797c7e05e90 Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Mon, 4 Nov 2024 13:26:03 +0100 Subject: [PATCH] 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. --- tasks/main.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 67af252..c436955 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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: @@ -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: @@ -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 @@ -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: @@ -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 @@ -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 }}"