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
396c7de8
Commit
396c7de8
authored
Oct 08, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkpoint Proctored Exam.
parent
ad3b9274
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
4 deletions
+53
-4
lms/djangoapps/course_blocks/transformers/library_content.py
+0
-4
lms/djangoapps/course_blocks/transformers/proctored_exams.py
+53
-0
No files found.
lms/djangoapps/course_blocks/transformers/library_content.py
View file @
396c7de8
...
...
@@ -2,7 +2,6 @@
Content Library Transformer, used to filter course structure per user.
"""
import
json
from
courseware.access
import
_has_access_to_course
from
courseware.models
import
StudentModule
from
openedx.core.lib.block_cache.transformer
import
BlockStructureTransformer
from
xmodule.library_content_module
import
LibraryContentModule
...
...
@@ -45,9 +44,6 @@ class ContentLibraryTransformer(BlockStructureTransformer):
Arguments:
block_structure (BlockStructureCollectedData)
Returns:
dict[UsageKey: dict]
"""
block_structure
.
request_xblock_fields
(
'mode'
)
block_structure
.
request_xblock_fields
(
'max_count'
)
...
...
lms/djangoapps/course_blocks/transformers/proctored_exams.py
0 → 100644
View file @
396c7de8
"""
Proctored Exams Transformer
"""
from
django.conf
import
settings
from
edx_proctoring.api
import
get_attempt_status_summary
from
edx_proctoring.models
import
ProctoredExamStudentAttemptStatus
from
openedx.core.lib.block_cache.transformer
import
BlockStructureTransformer
class
ProctoredExamTransformer
(
BlockStructureTransformer
):
"""
Proctored Exam Transformer Class
"""
VERSION
=
1
@classmethod
def
collect
(
cls
,
block_structure
):
"""
Computes any information for each XBlock that's necessary to execute
this transformer's transform method.
Arguments:
block_structure (BlockStructureCollectedData)
"""
block_structure
.
request_xblock_fields
(
'is_proctored_enabled'
)
block_structure
.
request_xblock_fields
(
'is_practice_exam'
)
def
transform
(
self
,
user_info
,
block_structure
):
"""
Mutates block_structure based on the given user_info.
"""
if
not
settings
.
FEATURES
.
get
(
'ENABLE_PROCTORED_EXAMS'
,
False
):
return
for
block_key
in
block_structure
.
topological_traversal
(
predicate
=
lambda
block_key
:
block_key
.
block_type
==
'sequential'
):
if
(
block_structure
.
get_xblock_field
(
block_key
,
'is_proctored_enabled'
)
or
block_structure
.
get_xblock_field
(
block_key
,
'is_practice_exam'
)
):
# This section is an exam. All of its sub-blocks should be excluded
# unless the user is not a verified student or has declined taking the exam.
user_exam_summary
=
get_attempt_status_summary
(
user_info
.
user
.
id
,
unicode
(
block_key
.
course_key
),
unicode
(
block_key
),
)
if
user_exam_summary
and
user_exam_summary
[
'status'
]
!=
ProctoredExamStudentAttemptStatus
.
declined
:
for
child_key
in
block_structure
.
get_children
(
block_key
):
block_structure
.
remove_block
(
child_key
,
keep_descendants
=
False
)
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