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
c8ce4a54
Commit
c8ce4a54
authored
May 21, 2014
by
Han Su Kim
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3621 from edx/han/cert-report
Added totals for different student tracks
parents
cc7987e5
263cf647
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
lms/djangoapps/certificates/management/commands/gen_cert_report.py
+22
-10
No files found.
lms/djangoapps/certificates/management/commands/gen_cert_report.py
View file @
c8ce4a54
...
@@ -61,11 +61,23 @@ class Command(BaseCommand):
...
@@ -61,11 +61,23 @@ class Command(BaseCommand):
# find students who are active
# find students who are active
# 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
(
enrolled_current
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_id
,
courseenrollment__course_id
=
course_id
,
courseenrollment__is_active
=
True
)
courseenrollment__is_active
=
True
)
enrolled_total
=
User
.
objects
.
filter
(
cert_data
[
course_id
]
=
{
'active'
:
active_students
.
count
()}
courseenrollment__course_id
=
course_id
)
verified_enrolled
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
,
mode__exact
=
'verified'
)
honor_enrolled
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
,
mode__exact
=
'honor'
)
audit_enrolled
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
,
mode__exact
=
'audit'
)
cert_data
[
course_id
]
=
{
'enrolled_current'
:
enrolled_current
.
count
(),
'enrolled_total'
:
enrolled_total
.
count
(),
'verified_enrolled'
:
verified_enrolled
.
count
(),
'honor_enrolled'
:
honor_enrolled
.
count
(),
'audit_enrolled'
:
audit_enrolled
.
count
()}
status_tally
=
GeneratedCertificate
.
objects
.
filter
(
status_tally
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
)
.
values
(
'status'
)
.
annotate
(
course_id__exact
=
course_id
)
.
values
(
'status'
)
.
annotate
(
...
@@ -83,21 +95,21 @@ class Command(BaseCommand):
...
@@ -83,21 +95,21 @@ class Command(BaseCommand):
for
mode
in
mode_tally
})
for
mode
in
mode_tally
})
# all states we have seen far all courses
# all states we have seen far all courses
status_headings
=
set
(
status_headings
=
s
orted
(
s
et
(
[
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
"{:>2
0
}"
.
format
(
"course ID"
),
print
"{:>2
6
}"
.
format
(
"course ID"
),
print
' '
.
join
([
"{:>1
2
}"
.
format
(
heading
)
print
' '
.
join
([
"{:>1
6
}"
.
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
:
print
"{0:>2
0}"
.
format
(
course_id
[
0
:
18
]),
print
"{0:>2
6}"
.
format
(
course_id
[
0
:
24
]),
for
heading
in
status_headings
:
for
heading
in
status_headings
:
if
heading
in
cert_data
[
course_id
]:
if
heading
in
cert_data
[
course_id
]:
print
"{:>1
2
}"
.
format
(
cert_data
[
course_id
][
heading
]),
print
"{:>1
6
}"
.
format
(
cert_data
[
course_id
][
heading
]),
else
:
else
:
print
" "
*
1
2
,
print
" "
*
1
6
,
print
print
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