-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:openedx/edx-enterprise into hamza…
…/ENT-8277-record-blackboard-client-calls
- Loading branch information
Showing
31 changed files
with
574 additions
and
436 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
Your project description goes here. | ||
""" | ||
|
||
__version__ = "4.10.13" | ||
__version__ = "4.11.4" |
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
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,23 @@ | ||
# Generated by Django 3.2.23 on 2024-01-30 06:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('enterprise', '0198_alter_enterprisecourseenrollment_options'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='enterprisecustomer', | ||
name='enable_academies', | ||
field=models.BooleanField(default=False, help_text='If checked, the learners will be able to see the academies on the learner portal dashboard.', verbose_name='Display academies screen'), | ||
), | ||
migrations.AddField( | ||
model_name='historicalenterprisecustomer', | ||
name='enable_academies', | ||
field=models.BooleanField(default=False, help_text='If checked, the learners will be able to see the academies on the learner portal dashboard.', verbose_name='Display academies screen'), | ||
), | ||
] |
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
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
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
67 changes: 67 additions & 0 deletions
67
...grated_channel/management/commands/remove_duplicate_learner_transmission_audit_records.py
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,67 @@ | ||
""" | ||
Transmits consenting enterprise learner data to the integrated channels. | ||
""" | ||
from logging import getLogger | ||
|
||
from django.apps import apps | ||
from django.contrib import auth | ||
from django.core.management.base import BaseCommand | ||
from django.db import transaction | ||
from django.db.models import Max | ||
from django.utils.translation import gettext as _ | ||
|
||
User = auth.get_user_model() | ||
LOGGER = getLogger(__name__) | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Management command which removes the duplicated transmission audit records for integration channels | ||
""" | ||
help = _(''' | ||
Transmit Enterprise learner course completion data for the given EnterpriseCustomer. | ||
''') | ||
|
||
def handle(self, *args, **options): | ||
""" | ||
Remove the duplicated transmission audit records for integration channels. | ||
""" | ||
# Multiple transmission records were being saved against single enterprise_course_enrollment_id in case | ||
# transmission fails against course and course run id. Job of this management command is to keep the latest | ||
# record for enterprise_course_enrollment_id that doesn't start with "course-v1: and delete all other records." | ||
channel_learner_audit_models = [ | ||
('moodle', 'MoodleLearnerDataTransmissionAudit'), | ||
('blackboard', 'BlackboardLearnerDataTransmissionAudit'), | ||
('cornerstone', 'CornerstoneLearnerDataTransmissionAudit'), | ||
('canvas', 'CanvasLearnerAssessmentDataTransmissionAudit'), | ||
('degreed2', 'Degreed2LearnerDataTransmissionAudit'), | ||
('sap_success_factors', 'SapSuccessFactorsLearnerDataTransmissionAudit'), | ||
] | ||
for app_label, model_name in channel_learner_audit_models: | ||
model_class = apps.get_model(app_label=app_label, model_name=model_name) | ||
|
||
latest_records_without_prefix = ( | ||
model_class.objects.exclude(course_id__startswith='course-v1:') | ||
.values('enterprise_course_enrollment_id').annotate(most_recent_transmission_id=Max('id')) | ||
) | ||
|
||
LOGGER.info( | ||
f'{app_label} channel has {latest_records_without_prefix.count()} records without prefix' | ||
) | ||
|
||
# Delete all duplicate records for each enterprise_course_enrollment_id | ||
with transaction.atomic(): | ||
for entry in latest_records_without_prefix: | ||
enterprise_course_enrollment_id = entry['enterprise_course_enrollment_id'] | ||
most_recent_transmission_id = entry['most_recent_transmission_id'] | ||
|
||
# Delete all records except the latest one without "course-v1:" | ||
duplicate_records_to_delete = ( | ||
model_class.objects | ||
.filter(enterprise_course_enrollment_id=enterprise_course_enrollment_id) | ||
.exclude(id=most_recent_transmission_id) | ||
) | ||
LOGGER.info( | ||
f'{app_label} channel - {duplicate_records_to_delete.count()} duplicate records are deleted' | ||
) | ||
duplicate_records_to_delete.delete() |
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
Oops, something went wrong.