Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a6a58d0e
Commit
a6a58d0e
authored
Jan 30, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pearson_dump: prettify, add missing error, provide default filename
parent
15a11e9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
common/djangoapps/student/management/commands/pearson_dump.py
+7
-5
No files found.
common/djangoapps/student/management/commands/pearson_dump.py
View file @
a6a58d0e
from
optparse
import
make_option
from
optparse
import
make_option
from
json
import
dump
from
json
import
dump
from
datetime
import
datetime
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
...
@@ -32,10 +33,9 @@ class Command(BaseCommand):
...
@@ -32,10 +33,9 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
if
len
(
args
)
<
1
:
if
len
(
args
)
<
1
:
raise
CommandError
(
"Missing single argument: output JSON file"
)
outputfile
=
datetime
.
utcnow
()
.
strftime
(
"pearson-dump-
%
Y
%
m
%
d-
%
H
%
M
%
S.json"
)
else
:
# get output location:
outputfile
=
args
[
0
]
outputfile
=
args
[
0
]
# construct the query object to dump:
# construct the query object to dump:
registrations
=
TestCenterRegistration
.
objects
.
all
()
registrations
=
TestCenterRegistration
.
objects
.
all
()
...
@@ -65,6 +65,8 @@ class Command(BaseCommand):
...
@@ -65,6 +65,8 @@ class Command(BaseCommand):
}
}
if
len
(
registration
.
upload_error_message
)
>
0
:
if
len
(
registration
.
upload_error_message
)
>
0
:
record
[
'registration_error'
]
=
registration
.
upload_error_message
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
:
if
registration
.
needs_uploading
:
record
[
'needs_uploading'
]
=
True
record
[
'needs_uploading'
]
=
True
...
@@ -72,5 +74,5 @@ class Command(BaseCommand):
...
@@ -72,5 +74,5 @@ class Command(BaseCommand):
# dump output:
# dump output:
with
open
(
outputfile
,
'w'
)
as
outfile
:
with
open
(
outputfile
,
'w'
)
as
outfile
:
dump
(
output
,
outfile
)
dump
(
output
,
outfile
,
indent
=
2
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment