Commit fecad2a3 by David Ormsbee

Merge pull request #1382 from MITx/feature/brian/pearson-status

pearson_dump: prettify, add missing error, provide default filename
parents 91b3a220 a6a58d0e
from optparse import make_option
from json import dump
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
......@@ -32,9 +33,8 @@ class Command(BaseCommand):
def handle(self, *args, **options):
if len(args) < 1:
raise CommandError("Missing single argument: output JSON file")
# get output location:
outputfile = datetime.utcnow().strftime("pearson-dump-%Y%m%d-%H%M%S.json")
else:
outputfile = args[0]
# construct the query object to dump:
......@@ -65,6 +65,8 @@ class Command(BaseCommand):
}
if len(registration.upload_error_message) > 0:
record['registration_error'] = registration.upload_error_message
if len(registration.testcenter_user.upload_error_message) > 0:
record['demographics_error'] = registration.testcenter_user.upload_error_message
if registration.needs_uploading:
record['needs_uploading'] = True
......@@ -72,5 +74,5 @@ class Command(BaseCommand):
# dump output:
with open(outputfile, 'w') as outfile:
dump(output, outfile)
dump(output, outfile, indent=2)
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