From cfb1d138453ef0cff2061ae00da21b7c6da000a4 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Fri, 9 Feb 2024 16:54:10 +0000 Subject: [PATCH 1/2] feat: add username and date export certificates On export certificates csv command add username and certificate creation date. resolves fccn/nau-technical#1 --- .../management/commands/export_course_certificates.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nau_openedx_extensions/management/commands/export_course_certificates.py b/nau_openedx_extensions/management/commands/export_course_certificates.py index 654d776..f332c2c 100644 --- a/nau_openedx_extensions/management/commands/export_course_certificates.py +++ b/nau_openedx_extensions/management/commands/export_course_certificates.py @@ -77,7 +77,9 @@ def handle(self, *args, **options): [ "course_id", "student email", + "student username", "student name", + "certificate created date", "certificate verify_uuid", "certificate_web_link_url", "certificate_download_pdf_link", @@ -97,7 +99,9 @@ def handle(self, *args, **options): [ course_id, certificate.user.email, + certificate.user.username, certificate.name, + certificate.created_date, certificate.verify_uuid, certificate_web_link_url, certificate_download_pdf_link, From 0ad1f7086e0254c2aa4d8849c95791199ac61ae8 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Fri, 9 Feb 2024 17:21:34 +0000 Subject: [PATCH 2/2] fix: link to instructor on http --- .../management/commands/export_course_certificates.py | 8 ++++---- .../commands/export_course_certificates_pdfs.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nau_openedx_extensions/management/commands/export_course_certificates.py b/nau_openedx_extensions/management/commands/export_course_certificates.py index f332c2c..94c1a6d 100644 --- a/nau_openedx_extensions/management/commands/export_course_certificates.py +++ b/nau_openedx_extensions/management/commands/export_course_certificates.py @@ -65,8 +65,8 @@ def handle(self, *args, **options): ) course_key = CourseKey.from_string(course_id) - lms_base = SiteConfiguration.get_value_for_org( - course_key.org, "LMS_BASE", settings.LMS_BASE + lms_root_url = SiteConfiguration.get_value_for_org( + course_key.org, "LMS_ROOT_URL", settings.LMS_ROOT_URL ) # prepare output @@ -89,7 +89,7 @@ def handle(self, *args, **options): # iterate each certificate and append each certificate as a row for certificate in course_generated_certificates: certificate_web_link_url = ( - "https://" + lms_base + "/certificates/" + certificate.verify_uuid + f"{lms_root_url}/certificates/{certificate.verify_uuid}" ) certificate_download_pdf_link = ( certificate_download_pdf_url + certificate.verify_uuid @@ -116,7 +116,7 @@ def handle(self, *args, **options): ) lms_instructor_data_download_url = ( - f"https://{lms_base}/courses/{course_id}/instructor#view-data_download" + f"{lms_root_url}/courses/{course_id}/instructor#view-data_download" ) self.log_msg( f"You can confirm the existence of the file on: {lms_instructor_data_download_url}" diff --git a/nau_openedx_extensions/management/commands/export_course_certificates_pdfs.py b/nau_openedx_extensions/management/commands/export_course_certificates_pdfs.py index e633641..8d12a7a 100644 --- a/nau_openedx_extensions/management/commands/export_course_certificates_pdfs.py +++ b/nau_openedx_extensions/management/commands/export_course_certificates_pdfs.py @@ -155,11 +155,11 @@ def handle(self, *args, **options): ) delete_recursive(course_certificate_folder) - lms_base = SiteConfiguration.get_value_for_org( - course_key.org, "LMS_BASE", settings.LMS_BASE + lms_root_url = SiteConfiguration.get_value_for_org( + course_key.org, "LMS_ROOT_URL", settings.LMS_ROOT_URL ) lms_instructor_data_download_url = ( - f"https://{lms_base}/courses/{course_id}/instructor#view-data_download" + f"{lms_root_url}/courses/{course_id}/instructor#view-data_download" ) self.log_msg( f"You can confirm the existence of the file on: {lms_instructor_data_download_url}"