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
62ffc246
Commit
62ffc246
authored
Nov 20, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1070 from MITx/feature/jarv/cert-status-fix
Feature/jarv/cert status fix
parents
000042e2
6d28be04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletions
+46
-1
lms/djangoapps/certificates/management/commands/fix_ungraded_certs.py
+45
-0
lms/djangoapps/certificates/queue.py
+1
-1
No files found.
lms/djangoapps/certificates/management/commands/fix_ungraded_certs.py
0 → 100644
View file @
62ffc246
from
certificates.models
import
GeneratedCertificate
from
courseware
import
grades
,
courses
from
django.test.client
import
RequestFactory
from
django.core.management.base
import
BaseCommand
from
optparse
import
make_option
class
Command
(
BaseCommand
):
help
=
"""
Find all students that need to be graded
and grade them.
"""
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'-n'
,
'--noop'
,
action
=
'store_true'
,
dest
=
'noop'
,
default
=
False
,
help
=
"Print but do not update the GeneratedCertificate table"
),
make_option
(
'-c'
,
'--course'
,
metavar
=
'COURSE_ID'
,
dest
=
'course'
,
default
=
False
,
help
=
'Grade ungraded users for this course'
),
)
def
handle
(
self
,
*
args
,
**
options
):
course_id
=
options
[
'course'
]
print
"Fetching ungraded students for {0}"
.
format
(
course_id
)
ungraded
=
GeneratedCertificate
.
objects
.
filter
(
course_id__exact
=
course_id
)
.
filter
(
grade__exact
=
''
)
course
=
courses
.
get_course_by_id
(
course_id
)
factory
=
RequestFactory
()
request
=
factory
.
get
(
'/'
)
for
cert
in
ungraded
:
# grade the student
grade
=
grades
.
grade
(
cert
.
user
,
request
,
course
)
print
"grading {0} - {1}"
.
format
(
cert
.
user
,
grade
[
'percent'
])
cert
.
grade
=
grade
[
'percent'
]
if
not
options
[
'noop'
]:
cert
.
save
()
lms/djangoapps/certificates/queue.py
View file @
62ffc246
...
...
@@ -240,7 +240,7 @@ class XQueueCertInterface(object):
cert
.
save
()
else
:
cert_status
=
status
.
notpassing
cert
.
grade
=
grade
[
'percent'
]
cert
.
status
=
cert_status
cert
.
user
=
student
cert
.
course_id
=
course_id
...
...
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