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
12b245a3
Commit
12b245a3
authored
Oct 12, 2015
by
Saleem Latif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove milestones when instructor clears a student's entry exam data
parent
69c47e09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
common/djangoapps/util/milestones_helpers.py
+25
-0
lms/djangoapps/instructor_task/api.py
+11
-0
No files found.
common/djangoapps/util/milestones_helpers.py
View file @
12b245a3
...
@@ -175,6 +175,18 @@ def fulfill_course_milestone(course_key, user):
...
@@ -175,6 +175,18 @@ def fulfill_course_milestone(course_key, user):
milestones_api
.
add_user_milestone
({
'id'
:
user
.
id
},
milestone
)
milestones_api
.
add_user_milestone
({
'id'
:
user
.
id
},
milestone
)
def
remove_course_milestones
(
course_key
,
user
,
relationship
):
"""
Remove all user milestones for the course specified by course_key.
"""
if
not
settings
.
FEATURES
.
get
(
'MILESTONES_APP'
,
False
):
return
None
from
milestones
import
api
as
milestones_api
course_milestones
=
milestones_api
.
get_course_milestones
(
course_key
=
course_key
,
relationship
=
relationship
)
for
milestone
in
course_milestones
:
milestones_api
.
remove_user_milestone
({
'id'
:
user
.
id
},
milestone
)
def
get_required_content
(
course
,
user
):
def
get_required_content
(
course
,
user
):
"""
"""
Queries milestones subsystem to see if the specified course is gated on one or more milestones,
Queries milestones subsystem to see if the specified course is gated on one or more milestones,
...
@@ -321,6 +333,19 @@ def get_course_content_milestones(course_id, content_id, relationship):
...
@@ -321,6 +333,19 @@ def get_course_content_milestones(course_id, content_id, relationship):
return
milestones_api
.
get_course_content_milestones
(
course_id
,
content_id
,
relationship
)
return
milestones_api
.
get_course_content_milestones
(
course_id
,
content_id
,
relationship
)
def
remove_course_content_user_milestones
(
course_key
,
content_key
,
user
,
relationship
):
"""
Removes the specified User-Milestone link from the system for the specified course content module.
"""
if
not
settings
.
FEATURES
.
get
(
'MILESTONES_APP'
,
False
):
return
[]
from
milestones
import
api
as
milestones_api
course_content_milestones
=
milestones_api
.
get_course_content_milestones
(
course_key
,
content_key
,
relationship
)
for
milestone
in
course_content_milestones
:
milestones_api
.
remove_user_milestone
({
'id'
:
user
.
id
},
milestone
)
def
remove_content_references
(
content_id
):
def
remove_content_references
(
content_id
):
"""
"""
Client API operation adapter/wrapper
Client API operation adapter/wrapper
...
...
lms/djangoapps/instructor_task/api.py
View file @
12b245a3
...
@@ -38,6 +38,7 @@ from instructor_task.api_helper import (
...
@@ -38,6 +38,7 @@ from instructor_task.api_helper import (
submit_task
,
submit_task
,
)
)
from
bulk_email.models
import
CourseEmail
from
bulk_email.models
import
CourseEmail
from
util
import
milestones_helpers
def
get_running_instructor_tasks
(
course_id
):
def
get_running_instructor_tasks
(
course_id
):
...
@@ -269,6 +270,8 @@ def submit_delete_entrance_exam_state_for_student(request, usage_key, student):
...
@@ -269,6 +270,8 @@ def submit_delete_entrance_exam_state_for_student(request, usage_key, student):
Module state for all problems in entrance exam will be deleted
Module state for all problems in entrance exam will be deleted
for specified student.
for specified student.
All User Milestones of entrance exam will be removed for the specified student
Parameters are `usage_key`, which must be a :class:`Location`
Parameters are `usage_key`, which must be a :class:`Location`
representing entrance exam section and the `student` as a User object.
representing entrance exam section and the `student` as a User object.
...
@@ -286,6 +289,14 @@ def submit_delete_entrance_exam_state_for_student(request, usage_key, student):
...
@@ -286,6 +289,14 @@ def submit_delete_entrance_exam_state_for_student(request, usage_key, student):
# check arguments: make sure entrance exam(section) exists for given usage_key
# check arguments: make sure entrance exam(section) exists for given usage_key
modulestore
()
.
get_item
(
usage_key
)
modulestore
()
.
get_item
(
usage_key
)
# Remove Content milestones that user has completed
milestones_helpers
.
remove_course_content_user_milestones
(
course_key
=
usage_key
.
course_key
,
content_key
=
usage_key
,
user
=
student
,
relationship
=
'fulfills'
)
task_type
=
'delete_problem_state'
task_type
=
'delete_problem_state'
task_class
=
delete_problem_state
task_class
=
delete_problem_state
task_input
,
task_key
=
encode_entrance_exam_and_student_input
(
usage_key
,
student
)
task_input
,
task_key
=
encode_entrance_exam_and_student_input
(
usage_key
,
student
)
...
...
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