fixing courses to be more properly unique when importing ocw data.
authorBryan <btbonval@gmail.com>
Thu, 9 Jan 2014 06:19:01 +0000 (01:19 -0500)
committerBryan <btbonval@gmail.com>
Thu, 9 Jan 2014 06:19:01 +0000 (01:19 -0500)
karmaworld/apps/notes/management/commands/import_ocw_json.py

index 323be164de2a73fa865433d78088bc6f92527575..93659027cae16a793484d89c8348df740f6c969e 100644 (file)
@@ -94,12 +94,13 @@ class Command(BaseCommand):
                     # Extract the course info
                     course_info = {
                       'name': course['courseTitle'],
-                      'instructor_name': course['professor'],
-                      'school': dbschool,
+                      'department': dbdept,
                     }
                     # Create or Find the Course object.
                     dbcourse = Course.objects.get_or_create(**course_info)[0]
                     dbcourse.professor = dbprof
+                    dbcourse.instructor_name = course['professor']
+                    dbcourse.school = dbschool
                     dbcourse.save()
                     print "Course is in the database: {0}".format(dbcourse.name)
 
@@ -165,7 +166,7 @@ class Command(BaseCommand):
                         # Do tags separately
                         dbnote.tags.add('mit-ocw','karma')
 
-                        print "Sending to GDrive and saving note to database."
+                        print "Converting document and saving note to database."
                         try:
                             convert_raw_document(dbnote)
                         except ValueError, e: