Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds management command to populate course cohorts for a course #269

Open
wants to merge 1 commit into
base: develop-juniper
Choose a base branch
from

Conversation

rehan99000
Copy link

@rehan99000 rehan99000 commented Sep 8, 2021

Description

This PR adds a management command that populates course cohorts for a course whose cohorts are missing. Some courses on cliffx and theology sites were presenting a broken cohorts page on the instructor dashboard. After running this command against such a course, the cohorts page should be fixed.

How to run:

./manage.py lms populate_cohorts_for_course --course <course-id>

Copy link

@zubair-arbi zubair-arbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added my feedback.

logger.info('Number of cohorts: %s', cohorts.count())
logger.info('Cohorts: %s', ', '.join(cohorts.values_list('name', flat=True)))
for cohort in cohorts:
CourseCohort.create(course_user_group=cohort)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we have some cohort groups already created? Maybe we need to use get/create

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zubair-arbi that is already handled inside this method.
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants