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
bcaa873b
Commit
bcaa873b
authored
Sep 30, 2016
by
Sanford Student
Committed by
Nimisha Asthagiri
Oct 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix for TNL-5601
fixes signal handling for delete student state
parent
4793a427
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
11 deletions
+38
-11
common/test/acceptance/pages/lms/staff_view.py
+2
-2
common/test/acceptance/tests/lms/test_progress_page.py
+24
-0
lms/djangoapps/instructor/enrollment.py
+4
-4
lms/djangoapps/instructor/tests/test_api.py
+2
-1
lms/djangoapps/instructor/tests/test_enrollment.py
+4
-3
lms/djangoapps/instructor/tests/test_services.py
+2
-1
No files found.
common/test/acceptance/pages/lms/staff_view.py
View file @
bcaa873b
...
...
@@ -95,8 +95,8 @@ class StaffDebugPage(PageObject):
This delete's a student's state for the problem
"""
if
user
:
self
.
q
(
css
=
'input[id^=sd_fu_]'
)
.
fill
(
user
)
self
.
q
(
css
=
'.staff-modal .staff-debug-sdelete'
)
.
click
()
self
.
q
(
css
=
'input[id^=sd_fu_]'
)
.
fi
rst
.
fi
ll
(
user
)
self
.
q
(
css
=
'.staff-modal .staff-debug-sdelete'
)
.
first
.
click
()
def
rescore
(
self
,
user
=
None
):
"""
...
...
common/test/acceptance/tests/lms/test_progress_page.py
View file @
bcaa873b
...
...
@@ -15,6 +15,7 @@ from ...pages.lms.courseware import CoursewarePage
from
...pages.lms.instructor_dashboard
import
InstructorDashboardPage
from
...pages.lms.problem
import
ProblemPage
from
...pages.lms.progress
import
ProgressPage
from
...pages.lms.staff_view
import
StaffPage
,
StaffDebugPage
from
...pages.studio.component_editor
import
ComponentEditorView
from
...pages.studio.utils
import
type_in_codemirror
from
...pages.studio.overview
import
CourseOutlinePage
...
...
@@ -192,6 +193,22 @@ class PersistentGradesTest(ProgressPageBaseTest):
type_in_codemirror
(
self
,
0
,
modified_content
)
modal
.
q
(
css
=
'.action-save'
)
.
click
()
def
_delete_student_state_for_problem
(
self
):
"""
As staff, clicks the "delete student state" button,
deleting the student user's state for the problem.
"""
with
self
.
_logged_in_session
(
staff
=
True
):
self
.
courseware_page
.
visit
()
staff_page
=
StaffPage
(
self
.
browser
,
self
.
course_id
)
self
.
assertEqual
(
staff_page
.
staff_view_mode
,
"Staff"
)
staff_page
.
q
(
css
=
'a.instructor-info-action'
)
.
nth
(
1
)
.
click
()
staff_debug_page
=
StaffDebugPage
(
self
.
browser
)
staff_debug_page
.
wait_for_page
()
staff_debug_page
.
delete_state
(
self
.
USERNAME
)
msg
=
staff_debug_page
.
idash_msg
[
0
]
self
.
assertEqual
(
u'Successfully deleted student state for user {0}'
.
format
(
self
.
USERNAME
),
msg
)
@ddt.data
(
_edit_problem_content
,
_change_subsection_structure
,
...
...
@@ -223,6 +240,13 @@ class PersistentGradesTest(ProgressPageBaseTest):
self
.
assertEqual
(
self
.
_get_problem_scores
(),
[(
1
,
1
),
(
0
,
1
)])
self
.
assertEqual
(
self
.
_get_section_score
(),
(
1
,
2
))
def
test_progress_page_updates_when_student_state_deleted
(
self
):
self
.
_check_progress_page_with_scored_problem
()
self
.
_delete_student_state_for_problem
()
with
self
.
_logged_in_session
():
self
.
assertEqual
(
self
.
_get_problem_scores
(),
[(
0
,
1
),
(
0
,
1
)])
self
.
assertEqual
(
self
.
_get_section_score
(),
(
0
,
2
))
class
SubsectionGradingPolicyTest
(
ProgressPageBaseTest
):
"""
...
...
lms/djangoapps/instructor/enrollment.py
View file @
bcaa873b
...
...
@@ -18,8 +18,8 @@ from courseware.model_data import FieldDataCache
from
courseware.module_render
import
get_module_for_descriptor
from
courseware.models
import
StudentModule
from
edxmako.shortcuts
import
render_to_string
from
grades.scores
import
weighted_score
from
grades.signals.signals
import
SCORE_CHANGED
from
lms.djangoapps.
grades.scores
import
weighted_score
from
lms.djangoapps.
grades.signals.signals
import
SCORE_CHANGED
from
lang_pref
import
LANGUAGE_KEY
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
submissions
import
api
as
sub_api
# installed from the edx-submissions repository
...
...
@@ -325,8 +325,8 @@ def _fire_score_changed_for_block(course_id, student, block, module_state_key):
points_possible
=
points_possible
,
points_earned
=
points_earned
,
user
=
student
,
course_id
=
course_id
,
usage_id
=
module_state_key
course_id
=
unicode
(
course_id
)
,
usage_id
=
unicode
(
module_state_key
)
)
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
bcaa873b
...
...
@@ -3190,7 +3190,8 @@ class TestInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTes
})
self
.
assertEqual
(
response
.
status_code
,
400
)
def
test_reset_student_attempts_delete
(
self
):
@patch
(
'courseware.module_render.SCORE_CHANGED.send'
)
def
test_reset_student_attempts_delete
(
self
,
_mock_signal
):
""" Test delete single student state. """
url
=
reverse
(
'reset_student_attempts'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
post
(
url
,
{
...
...
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
bcaa873b
...
...
@@ -378,7 +378,8 @@ class TestInstructorEnrollmentStudentModule(SharedModuleStoreTestCase):
reset_student_attempts
(
self
.
course_key
,
self
.
user
,
msk
,
requesting_user
=
self
.
user
)
self
.
assertEqual
(
json
.
loads
(
module
()
.
state
)[
'attempts'
],
0
)
def
test_delete_student_attempts
(
self
):
@mock.patch
(
'courseware.module_render.SCORE_CHANGED.send'
)
def
test_delete_student_attempts
(
self
,
_mock_signal
):
msk
=
self
.
course_key
.
make_usage_key
(
'dummy'
,
'module'
)
original_state
=
json
.
dumps
({
'attempts'
:
32
,
'otherstuff'
:
'alsorobots'
})
StudentModule
.
objects
.
create
(
...
...
@@ -404,7 +405,7 @@ class TestInstructorEnrollmentStudentModule(SharedModuleStoreTestCase):
# Disable the score change signal to prevent other components from being
# pulled into tests.
@mock.patch
(
'courseware.module_render.SCORE_CHANGED.send'
)
def
test_delete_submission_scores
(
self
,
_
lti_mock
):
def
test_delete_submission_scores
(
self
,
_
mock_signal
):
user
=
UserFactory
()
problem_location
=
self
.
course_key
.
make_usage_key
(
'dummy'
,
'module'
)
...
...
@@ -548,7 +549,7 @@ class TestStudentModuleGrading(SharedModuleStoreTestCase):
self
.
course
,
get_course_blocks
(
self
.
user
,
self
.
course
.
location
)
)
grade
=
subsection_grade_factory
.
upd
ate
(
self
.
sequence
)
grade
=
subsection_grade_factory
.
cre
ate
(
self
.
sequence
)
self
.
assertEqual
(
grade
.
all_total
.
earned
,
all_earned
)
self
.
assertEqual
(
grade
.
graded_total
.
earned
,
graded_earned
)
self
.
assertEqual
(
grade
.
all_total
.
possible
,
all_possible
)
...
...
lms/djangoapps/instructor/tests/test_services.py
View file @
bcaa873b
...
...
@@ -49,7 +49,8 @@ class InstructorServiceTests(SharedModuleStoreTestCase):
state
=
json
.
dumps
({
'attempts'
:
2
}),
)
def
test_reset_student_attempts_delete
(
self
):
@mock.patch
(
'courseware.module_render.SCORE_CHANGED.send'
)
def
test_reset_student_attempts_delete
(
self
,
_mock_signal
):
"""
Test delete student state.
"""
...
...
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