lms.djangoapps.program_enrollments.management.commands package#
Submodules#
lms.djangoapps.program_enrollments.management.commands.expire_waiting_enrollments module#
Management command to cleanup old waiting enrollments
- class lms.djangoapps.program_enrollments.management.commands.expire_waiting_enrollments.Command(stdout=None, stderr=None, no_color=False, force_color=False)#
Bases:
BaseCommandDeletes enrollments not tied to a user that have not been modified for at least 60 days.
- Example usage:
$ ./manage.py lms expire_waiting_enrollments
- WAITING_ENROLLMENTS_EXPIRATION_DAYS = 60#
- add_arguments(parser)#
Entry point for subclassed commands to add custom arguments.
- handle(*args, **options)#
The actual logic of the command. Subclasses must implement this method.
- help = 'Remove expired enrollments that have not been linked to a user.'#
lms.djangoapps.program_enrollments.management.commands.link_program_enrollments module#
Management command to link program enrollments and external student_keys to an LMS user
- class lms.djangoapps.program_enrollments.management.commands.link_program_enrollments.Command(stdout=None, stderr=None, no_color=False, force_color=False)#
Bases:
BaseCommandManagement command to manually link ProgramEnrollments without an LMS user to an LMS user by username.
- Usage:
./manage.py lms link_program_enrollments <program_uuid> <user_item>* where a <user_item> is a string formatted as <external_user_key>:<lms_username>
Normally, program enrollments should be linked by the Django Social Auth post_save signal handler lms.djangoapps.program_enrollments.signals.matriculate_learner, but in the case that a partner does not have an IDP set up for learners to log in through, we need a way to link enrollments.
Provided a program uuid and a list of external_user_key:lms_username, this command will look up the matching program enrollments and users, and update the program enrollments with the matching user. If the program enrollment has course enrollments, we will enroll the user into their waiting program courses.
If an external user key is specified twice, an exception will be raised and no enrollments will be modified.
- For each external_user_key:lms_username, if:
The user is not found
No enrollment is found for the given program and external_user_key
The enrollment already has a user
An error message will be logged and the input will be skipped. All other inputs will be processed and enrollments updated.
If there is an error while enrolling a user in a waiting program course enrollment, the error will be logged, and we will roll back all transactions for that user so that their db state will be the same as it was before this command was run. This is to allow the re-running of the same command again to correctly enroll the user once the issue preventing the enrollment has been resolved.
No other users will be affected, they will be processed normally.
- add_arguments(parser)#
Entry point for subclassed commands to add custom arguments.
- handle(program_uuid, user_items, *args, **options)#
The actual logic of the command. Subclasses must implement this method.
- help = 'Manually links ProgramEnrollment records to LMS users'#
- parse_user_items(user_items)#
- Params:
list of strings in the format ‘external_user_key:lms_username’
- Returns:
dict mapping external user keys to lms usernames
- Raises:
CommandError –
lms.djangoapps.program_enrollments.management.commands.migrate_saml_uids module#
Management command to re-write UIDs identifying learners in external organizations’ systems
Intented for use in production environments, to help support migration of existing SSO learners into our most-recent program enrollment flow without needing to manually re-link their account.
- class lms.djangoapps.program_enrollments.management.commands.migrate_saml_uids.Command(stdout=None, stderr=None, no_color=False, force_color=False)#
Bases:
BaseCommandUpdates UserSocialAuth records to use UIDs provided in the supplied JSON file
- Example usage:
- $ ./manage.py lms migrate_saml_uids.py –uid-mapping=path/to/file.json
–saml-provider-slug=default
- add_arguments(parser)#
Entry point for subclassed commands to add custom arguments.
- handle(*args, **options)#
Performs the re-writing
- help = 'Updates UserSocialAuth records to use UIDs provided in the supplied JSON file\n\nExample usage:\n $ ./manage.py lms migrate_saml_uids.py --uid-mapping=path/to/file.json\n --saml-provider-slug=default'#
lms.djangoapps.program_enrollments.management.commands.reset_enrollment_data module#
Management command to remove enrollments and any related models created as a side effect of enrolling students.
Intented for use in integration sandbox environments
- class lms.djangoapps.program_enrollments.management.commands.reset_enrollment_data.Command(stdout=None, stderr=None, no_color=False, force_color=False)#
Bases:
BaseCommandDeletes all enrollments and related data
- Example usage:
$ ./manage.py lms reset_enrollment_data ca73b4af-676a-4bb3-a9a5-f6b5a3dedd,1c5f61b9-0be5-4a90-9ea5-582d5e066c
- add_arguments(parser)#
Entry point for subclassed commands to add custom arguments.
- confirmation_prompt = "Type 'confirm' to continue with deletion\n"#
- handle(*args, **options)#
The actual logic of the command. Subclasses must implement this method.
- help = 'Deletes all enrollments and related data\n\nExample usage:\n $ ./manage.py lms reset_enrollment_data ca73b4af-676a-4bb3-a9a5-f6b5a3dedd,1c5f61b9-0be5-4a90-9ea5-582d5e066c'#
lms.djangoapps.program_enrollments.management.commands.send_program_course_nudge_email module#
Django management command for sending nudge emails to learners after they complete once course in a program, to suggest to complete possible next course from same program.
- class lms.djangoapps.program_enrollments.management.commands.send_program_course_nudge_email.Command(stdout=None, stderr=None, no_color=False, force_color=False)#
Bases:
BaseCommandDjango management command for sending nudge emails to learners
This command sends nudge emails to complete next course to learners after they complete a course that is linked with one or multiple programs. if next course in the program is already in progress, command skips that program and try to propose course for next linked program.
- Example usage:
$ ./manage.py lms send_program_course_nudge_email $ ./manage.py lms send_program_course_nudge_email –no-commit
- add_arguments(parser)#
Entry point to add arguments.
- emit_event(user, program, suggested_course_run, suggested_course, completed_course_run)#
Emit the Segment event which will be used by Braze to send the email
- find_detailed_program(programs, program_progress)#
get detailed program.
- static get_candidate_program_and_courses(program, program_progress)#
Get program in a new format containing candidate_courses and in_progress_courses_ids
- get_candidate_programs(programs, programs_progress)#
Get all programs with candidate courses.
- get_course_run(program, course_run_id)#
get course run from a program.
- get_course_run_to_suggest(candidate_programs, completed_course_id, user)#
Finds out enrollable course run from programs Generated by ProgramProgressMeter.
Returns: Suggested program and course_run dicts
- get_passed_course_to_users_maps()#
Returns mapping between course passed yesterday with passing users.
- handle(*args, **options)#
Command’s entry point.
- sort_programs(programs)#
Sorts programs based on their revenue ranking.
- valid_course_run(course_run)#
Check if a course run is in enrollable state.