diff --git a/common/djangoapps/student/management/commands/pearson_make_tc_registration.py b/common/djangoapps/student/management/commands/pearson_make_tc_registration.py index 81a478d19d..0f28ceb283 100644 --- a/common/djangoapps/student/management/commands/pearson_make_tc_registration.py +++ b/common/djangoapps/student/management/commands/pearson_make_tc_registration.py @@ -71,6 +71,12 @@ class Command(BaseCommand): dest='ignore_registration_dates', help='find exam info for course based on exam_series_code, even if the exam is not active.' ), + make_option( + '--create_dummy_exam', + action='store_true', + dest='create_dummy_exam', + help='create dummy exam info for course, even if course exists' + ), ) args = "" help = "Create or modify a TestCenterRegistration entry for a given Student" @@ -99,6 +105,7 @@ class Command(BaseCommand): raise CommandError("User \"{}\" does not have an existing demographics record".format(username)) # check to see if a course_id was specified, and use information from that: + create_dummy_exam = 'create_dummy_exam' in our_options and our_options['create_dummy_exam'] try: course = course_from_id(course_id) if 'ignore_registration_dates' in our_options: @@ -107,6 +114,9 @@ class Command(BaseCommand): else: exam = course.current_test_center_exam except ItemNotFoundError: + create_dummy_exam = True + + if exam is None and create_dummy_exam: # otherwise use explicit values (so we don't have to define a course): exam_name = "Dummy Placeholder Name" exam_info = { 'Exam_Series_Code': our_options['exam_series_code'], @@ -120,7 +130,7 @@ class Command(BaseCommand): our_options['eligibility_appointment_date_last'] = strftime("%Y-%m-%d", exam.last_eligible_appointment_date) if exam is None: - raise CommandError("Exam for course_id {%s} does not exist".format(course_id)) + raise CommandError("Exam for course_id {} does not exist".format(course_id)) exam_code = exam.exam_series_code diff --git a/common/djangoapps/student/management/commands/pearson_transfer.py b/common/djangoapps/student/management/commands/pearson_transfer.py index 2124bdceb6..6811e1833d 100644 --- a/common/djangoapps/student/management/commands/pearson_transfer.py +++ b/common/djangoapps/student/management/commands/pearson_transfer.py @@ -111,7 +111,10 @@ class Command(BaseCommand): with dog_stats_api.timer('pearson.{0}'.format(mode), tags='s3'): try: for filename in os.listdir(files_from): - upload_file_to_s3(bucket, files_from, filename) + source_file = os.path.join(files_from, filename) + # use mode as name of directory into which to write files + dest_file = os.path.join(mode, filename) + upload_file_to_s3(bucket, source_file, dest_file) if deleteAfterCopy: os.remove(files_from + '/' + filename) except: @@ -119,7 +122,7 @@ class Command(BaseCommand): 's3 archiving failed') raise - def upload_file_to_s3(bucket, source_dir, filename): + def upload_file_to_s3(bucket, source_file, dest_file): """ Upload file to S3 """ @@ -128,8 +131,8 @@ class Command(BaseCommand): from boto.s3.key import Key b = s3.get_bucket(bucket) k = Key(b) - k.key = "{filename}".format(filename=filename) - k.set_contents_from_filename(os.path.join(source_dir, filename)) + k.key = "{filename}".format(filename=dest_file) + k.set_contents_from_filename(source_file) def export_pearson(): options = { 'dest-from-settings' : True } diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 5416dae583..7f97ca69dc 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -655,7 +655,7 @@ class CourseDescriptor(SequenceDescriptor): @property def registration_end_date_text(self): - return time.strftime("%b %d, %Y", self.registration_end_date) + return time.strftime("%b %d, %Y at %H:%M UTC", self.registration_end_date) @property def current_test_center_exam(self): diff --git a/lms/templates/test_center_register.html b/lms/templates/test_center_register.html index f6c53c0e89..6b87860fad 100644 --- a/lms/templates/test_center_register.html +++ b/lms/templates/test_center_register.html @@ -466,7 +466,7 @@ Last Eligible Appointment Date: ${exam_info.last_eligible_appointment_date_text}
  • - Registration End Date: ${exam_info.registration_end_date_text} + Registration Ends: ${exam_info.registration_end_date_text}
  • % endif