Skip to content

Commit

Permalink
Rectivate enrollments for Differential Calculus (#2325)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
annagav and pre-commit-ci[bot] authored Aug 5, 2024
1 parent c181ef8 commit 8cfe212
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions courses/migrations/0053_reactivate_wrong_program_enrollments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2.25 on 2024-08-05 14:45

from django.db import migrations


def deactivate_program_enrollments(apps, schema_editor):
"""Deactivate all Enrollments for this not yet live program 18.03x Differential Equations
and activate back for Differential Calculus
"""
ProgramEnrollments = apps.get_model("courses", "ProgramEnrollment")
enrollments = ProgramEnrollments.objects.filter(
program__readable_id="program-v1:MITxT+18.01x"
)
for enrollment in enrollments:
enrollment.active = True
enrollment.save()

enrollments = ProgramEnrollments.objects.filter(
program__readable_id="program-v1:MITxT+18.03x"
)
for enrollment in enrollments:
enrollment.active = False
enrollment.save()


class Migration(migrations.Migration):
dependencies = [
("courses", "0052_deactivate_enrollments"),
]

operations = [
migrations.RunPython(deactivate_program_enrollments, migrations.RunPython.noop),
]

0 comments on commit 8cfe212

Please sign in to comment.