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
cb06091c
Commit
cb06091c
authored
Jun 20, 2014
by
Justin Riley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup get_assignments_attempted_and_failed
parent
3f9b1ef7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
37 deletions
+35
-37
lms/djangoapps/courseware/module_tree_reset.py
+35
-37
No files found.
lms/djangoapps/courseware/module_tree_reset.py
View file @
cb06091c
...
...
@@ -296,45 +296,43 @@ class ProctorModuleInfo(object):
ret
[
"grade_
%
s"
%
stat
[
'name'
]]
=
''
return
ret
def
_get_od_for_assignment
(
self
,
student
,
assignment
):
return
OrderedDict
(
id
=
student
.
id
,
name
=
student
.
profile
.
name
,
username
=
student
.
username
,
assignment
=
assignment
[
'name'
],
problem
=
assignment
[
'problem'
],
date
=
str
(
datetime
.
datetime
.
now
()),
earned
=
assignment
[
'earned'
],
possible
=
assignment
[
'possible'
])
def
get_assignments_attempted_and_failed
(
self
,
student
,
do_reset
=
False
):
status
=
self
.
get_student_status
(
student
)
assignments
=
[]
for
stat
in
status
[
'assignments'
]:
if
stat
[
'attempted'
]:
if
not
stat
[
'earned'
]
==
stat
[
'possible'
]:
log
.
info
(
"Student
%
s Assignment
%
s attempted '
%
s' but failed "
"(
%
s/
%
s)"
%
(
student
,
stat
[
'name'
],
stat
[
'problem'
],
stat
[
'earned'
],
stat
[
'possible'
]))
assignments
.
append
(
OrderedDict
(
id
=
student
.
id
,
name
=
student
.
profile
.
name
,
username
=
student
.
username
,
assignment
=
stat
[
'name'
],
problem
=
stat
[
'problem'
],
date
=
str
(
datetime
.
datetime
.
now
()),
earned
=
stat
[
'earned'
],
possible
=
stat
[
'possible'
],
))
if
do_reset
:
aaf
=
assignments
[
-
1
]
try
:
log
.
debug
(
'resetting
%
s for student
%
s'
%
(
aaf
[
'assignment'
],
aaf
[
'username'
]))
cloc
=
self
.
course
.
location
assi_url
=
Location
(
cloc
.
tag
,
cloc
.
org
,
cloc
.
course
,
'proctor'
,
aaf
[
'assignment'
])
pmod
=
self
.
ms
.
get_instance
(
self
.
course
.
id
,
assi_url
.
url
())
tnset
=
TreeNodeSet
(
self
.
course
.
id
,
pmod
,
self
.
ms
,
student
)
msg
=
tnset
.
reset_randomization
()
log
.
debug
(
str
(
msg
))
except
Exception
:
log
.
exception
(
"Failed to do reset of
%
s for
%
s"
%
(
aaf
[
'assignment'
],
student
))
return
assignments
failed
=
[
self
.
_get_od_for_assignment
(
a
)
for
a
in
status
[
'assignments'
]
if
a
[
'attempted'
]
and
a
[
'earned'
]
!=
a
[
'possible'
]]
for
f
in
failed
:
log
.
info
(
"Student
%
s Assignment
%
s attempted '
%
s' but failed "
"(
%
s/
%
s)"
%
(
student
,
f
[
'assignment'
],
f
[
'problem'
],
f
[
'earned'
],
f
[
'possible'
]))
if
do_reset
:
try
:
log
.
debug
(
'resetting
%
s for student
%
s'
%
(
f
[
'assignment'
],
f
[
'username'
]))
cloc
=
self
.
course
.
location
assi_url
=
Location
(
cloc
.
tag
,
cloc
.
org
,
cloc
.
course
,
'proctor'
,
f
[
'assignment'
])
pmod
=
self
.
ms
.
get_instance
(
self
.
course
.
id
,
assi_url
.
url
())
tnset
=
TreeNodeSet
(
self
.
course
.
id
,
pmod
,
self
.
ms
,
student
)
msg
=
tnset
.
reset_randomization
()
log
.
debug
(
str
(
msg
))
except
Exception
:
log
.
exception
(
"Failed to do reset of
%
s for
%
s"
%
(
f
[
'assignment'
],
student
))
return
failed
def
getip
(
request
):
...
...
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