Commit 23c72e73 by Matt Drayer Committed by Jonathan Piacenti

mattdrayer/gradebook-script-rename: Fixed conflicted command name

parent 4690e310
...@@ -22,7 +22,7 @@ class Command(BaseCommand): ...@@ -22,7 +22,7 @@ class Command(BaseCommand):
for cg in course_groups: for cg in course_groups:
current_course_id = cg.course_id current_course_id = cg.course_id
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
cg.course_id = oldstyle_course_id cg.course_id = oldstyle_course_id
cg.save() cg.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -32,12 +32,12 @@ class Command(BaseCommand): ...@@ -32,12 +32,12 @@ class Command(BaseCommand):
for ccg in course_content_groups: for ccg in course_content_groups:
current_course_id = ccg.course_id current_course_id = ccg.course_id
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
ccg.course_id = oldstyle_course_id ccg.course_id = oldstyle_course_id
current_content_id = ccg.content_id current_content_id = ccg.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
ccg.content_id = oldstyle_content_id ccg.content_id = oldstyle_content_id
ccg.save() ccg.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -47,18 +47,18 @@ class Command(BaseCommand): ...@@ -47,18 +47,18 @@ class Command(BaseCommand):
for cmc in course_module_completions: for cmc in course_module_completions:
current_course_id = cmc.course_id current_course_id = cmc.course_id
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
cmc.course_id = oldstyle_course_id cmc.course_id = oldstyle_course_id
current_content_id = cmc.content_id current_content_id = cmc.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
cmc.content_id = oldstyle_content_id cmc.content_id = oldstyle_content_id
if cmc.stage is not None: if cmc.stage is not None:
current_stage = cmc.stage current_stage = cmc.stage
oldstyle_stage = current_stage.replace("slashes:", "") oldstyle_stage = current_stage.replace("slashes:", "")
oldstyle_stage = current_stage.replace("+", "/") oldstyle_stage = oldstyle_stage.replace("+", "/")
cmc.stage = oldstyle_stage cmc.stage = oldstyle_stage
cmc.save() cmc.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -23,7 +23,7 @@ class Command(BaseCommand): ...@@ -23,7 +23,7 @@ class Command(BaseCommand):
for gbe in gradebook_entries: for gbe in gradebook_entries:
current_course_id = unicode(gbe.course_id) current_course_id = unicode(gbe.course_id)
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
gbe.course_id = CourseKey.from_string(oldstyle_course_id) gbe.course_id = CourseKey.from_string(oldstyle_course_id)
gbe.save() gbe.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -33,7 +33,7 @@ class Command(BaseCommand): ...@@ -33,7 +33,7 @@ class Command(BaseCommand):
for he in history_entries: for he in history_entries:
current_course_id = unicode(he.course_id) current_course_id = unicode(he.course_id)
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
he.course_id = oldstyle_course_id he.course_id = oldstyle_course_id
he.save() he.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -8,8 +8,8 @@ import uuid ...@@ -8,8 +8,8 @@ import uuid
from django.contrib.auth.models import User from django.contrib.auth.models import User
from gradebook import models as gradebook_models from gradebook import models as gradebook_models
from gradebook.management.commands import migrate_courseids_v2
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from gradebook.management.commands import migrate_gradebook_courseids_v2
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
...@@ -71,7 +71,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase): ...@@ -71,7 +71,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
# Run the data migration # Run the data migration
migrate_courseids_v2.Command().handle() migrate_gradebook_courseids_v2.Command().handle()
# Confirm that the data has been properly migrated # Confirm that the data has been properly migrated
......
...@@ -21,12 +21,12 @@ class Command(BaseCommand): ...@@ -21,12 +21,12 @@ class Command(BaseCommand):
for project in projects: for project in projects:
current_course_id = project.course_id current_course_id = project.course_id
oldstyle_course_id = current_course_id.replace("slashes:", "") oldstyle_course_id = current_course_id.replace("slashes:", "")
oldstyle_course_id = current_course_id.replace("+", "/") oldstyle_course_id = oldstyle_course_id.replace("+", "/")
project.course_id = oldstyle_course_id project.course_id = oldstyle_course_id
current_content_id = project.content_id current_content_id = project.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
project.content_id = oldstyle_content_id project.content_id = oldstyle_content_id
project.save() project.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -34,9 +34,10 @@ class Command(BaseCommand): ...@@ -34,9 +34,10 @@ class Command(BaseCommand):
log.warning('Migrating Workgroup Reviews...') log.warning('Migrating Workgroup Reviews...')
workgroup_reviews = WorkgroupReview.objects.all() workgroup_reviews = WorkgroupReview.objects.all()
for wr in workgroup_reviews: for wr in workgroup_reviews:
if wr.content_id is not None:
current_content_id = wr.content_id current_content_id = wr.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
wr.content_id = oldstyle_content_id wr.content_id = oldstyle_content_id
wr.save() wr.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -44,9 +45,10 @@ class Command(BaseCommand): ...@@ -44,9 +45,10 @@ class Command(BaseCommand):
log.warning('Migrating Workgroup Peer Reviews...') log.warning('Migrating Workgroup Peer Reviews...')
workgroup_peer_reviews = WorkgroupPeerReview.objects.all() workgroup_peer_reviews = WorkgroupPeerReview.objects.all()
for wpr in workgroup_reviews: for wpr in workgroup_reviews:
if wpr.content_id is not None:
current_content_id = wpr.content_id current_content_id = wpr.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
wpr.content_id = oldstyle_content_id wpr.content_id = oldstyle_content_id
wpr.save() wpr.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -54,9 +56,10 @@ class Command(BaseCommand): ...@@ -54,9 +56,10 @@ class Command(BaseCommand):
log.warning('Migrating Workgroup Submission Reviews...') log.warning('Migrating Workgroup Submission Reviews...')
workgroup_submission_reviews = WorkgroupSubmissionReview.objects.all() workgroup_submission_reviews = WorkgroupSubmissionReview.objects.all()
for wsr in workgroup_submission_reviews: for wsr in workgroup_submission_reviews:
if wsr.content_id is not None:
current_content_id = wsr.content_id current_content_id = wsr.content_id
oldstyle_content_id = current_content_id.replace("slashes:", "") oldstyle_content_id = current_content_id.replace("slashes:", "")
oldstyle_content_id = current_content_id.replace("+", "/") oldstyle_content_id = oldstyle_content_id.replace("+", "/")
wsr.content_id = oldstyle_content_id wsr.content_id = oldstyle_content_id
wsr.save() wsr.save()
log.warning('Complete!') log.warning('Complete!')
...@@ -5,18 +5,14 @@ Run these tests @ Devstack: ...@@ -5,18 +5,14 @@ Run these tests @ Devstack:
from datetime import datetime from datetime import datetime
import uuid import uuid
from django.contrib.auth.models import Group, User from django.contrib.auth.models import User
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings
from projects.management.commands import migrate_project_courseids_v2 from projects.management.commands import migrate_project_courseids_v2
from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE
from projects.models import Project, Workgroup, WorkgroupReview, WorkgroupPeerReview, WorkgroupSubmission, WorkgroupSubmissionReview from projects.models import Project, Workgroup, WorkgroupReview, WorkgroupPeerReview, WorkgroupSubmission, WorkgroupSubmissionReview
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from django.db import connection
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class MigrateCourseIdsTests(TestCase): class MigrateCourseIdsTests(TestCase):
""" """
Test suite for data migration script Test suite for data migration script
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment