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
36865b84
Commit
36865b84
authored
May 05, 2014
by
Han Su Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flake8 cleanup
parent
b8541db1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
lms/djangoapps/certificates/management/commands/gen_cert_report.py
+19
-19
No files found.
lms/djangoapps/certificates/management/commands/gen_cert_report.py
View file @
36865b84
...
@@ -30,20 +30,20 @@ class Command(BaseCommand):
...
@@ -30,20 +30,20 @@ class Command(BaseCommand):
option_list
=
BaseCommand
.
option_list
+
(
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'-c'
,
'--course'
,
make_option
(
'-c'
,
'--course'
,
metavar
=
'COURSE_ID'
,
metavar
=
'COURSE_ID'
,
dest
=
'course'
,
dest
=
'course'
,
default
=
None
,
default
=
None
,
help
=
'Only generate for COURSE_ID'
),
help
=
'Only generate for COURSE_ID'
),
)
)
def
_ended_courses
(
self
):
def
_ended_courses
(
self
):
for
course_id
in
[
course
# all courses in COURSE_LISTINGS
for
course_id
in
[
course
# all courses in COURSE_LISTINGS
for
sub
in
settings
.
COURSE_LISTINGS
for
sub
in
settings
.
COURSE_LISTINGS
for
course
in
settings
.
COURSE_LISTINGS
[
sub
]]:
for
course
in
settings
.
COURSE_LISTINGS
[
sub
]]:
course_loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
course_loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
course
=
modulestore
()
.
get_instance
(
course_id
,
course_loc
)
course
=
modulestore
()
.
get_instance
(
course_id
,
course_loc
)
if
course
.
has_ended
():
if
course
.
has_ended
():
yield
course_id
yield
course_id
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
...
@@ -62,26 +62,26 @@ class Command(BaseCommand):
...
@@ -62,26 +62,26 @@ class Command(BaseCommand):
# enrolled students are always downloable + notpassing
# enrolled students are always downloable + notpassing
print
"Looking up certificate states for {0}"
.
format
(
course_id
)
print
"Looking up certificate states for {0}"
.
format
(
course_id
)
active_students
=
User
.
objects
.
filter
(
active_students
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_id
,
courseenrollment__course_id
=
course_id
,
courseenrollment__is_active
=
True
)
courseenrollment__is_active
=
True
)
cert_data
[
course_id
]
=
{
'active'
:
active_students
.
count
()}
cert_data
[
course_id
]
=
{
'active'
:
active_students
.
count
()}
tallies
=
GeneratedCertificate
.
objects
.
filter
(
tallies
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
)
.
values
(
'status'
)
.
annotate
(
course_id__exact
=
course_id
)
.
values
(
'status'
)
.
annotate
(
dcount
=
Count
(
'status'
))
dcount
=
Count
(
'status'
))
cert_data
[
course_id
]
.
update
(
cert_data
[
course_id
]
.
update
(
{
status
[
'status'
]:
status
[
'dcount'
]
{
status
[
'status'
]:
status
[
'dcount'
]
for
status
in
tallies
})
for
status
in
tallies
})
# all states we have seen far all courses
# all states we have seen far all courses
status_headings
=
set
(
status_headings
=
set
(
[
status
for
course
in
cert_data
[
status
for
course
in
cert_data
for
status
in
cert_data
[
course
]])
for
status
in
cert_data
[
course
]])
# print the heading for the report
# print the heading for the report
print
"{:>20}"
.
format
(
"course ID"
),
print
"{:>20}"
.
format
(
"course ID"
),
print
' '
.
join
([
"{:>12}"
.
format
(
heading
)
print
' '
.
join
([
"{:>12}"
.
format
(
heading
)
for
heading
in
status_headings
])
for
heading
in
status_headings
])
# print the report
# print the report
for
course_id
in
cert_data
:
for
course_id
in
cert_data
:
...
...
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