Commit a15110f0 by Sarina Canelake

Remove Grade Adjustment code from legacy dash

parent 0a5af2a3
"""
View-level tests for resetting student state in legacy instructor dash.
"""
import json
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from courseware.tests.helpers import LoginEnrollmentTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
from xmodule.modulestore.tests.factories import CourseFactory
from student.tests.factories import UserFactory, AdminFactory, CourseEnrollmentFactory
from courseware.models import StudentModule
from submissions import api as sub_api
from student.models import anonymous_id_for_user
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InstructorResetStudentStateTest(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Reset student state from the legacy instructor dash.
"""
def setUp(self):
"""
Log in as an instructor, and create a course/student to reset.
"""
instructor = AdminFactory.create()
self.client.login(username=instructor.username, password='test')
self.student = UserFactory.create(username='test', email='test@example.com')
self.course = CourseFactory.create()
CourseEnrollmentFactory.create(user=self.student, course_id=self.course.id)
def test_delete_student_state_resets_scores(self):
problem_location = self.course.id.make_usage_key('dummy', 'module')
# Create a student module for the user
StudentModule.objects.create(
student=self.student,
course_id=self.course.id,
module_state_key=problem_location,
state=json.dumps({})
)
# Create a submission and score for the student using the submissions API
student_item = {
'student_id': anonymous_id_for_user(self.student, self.course.id),
'course_id': self.course.id.to_deprecated_string(),
'item_id': problem_location.to_deprecated_string(),
'item_type': 'openassessment'
}
submission = sub_api.create_submission(student_item, 'test answer')
sub_api.set_score(submission['uuid'], 1, 2)
# Delete student state using the instructor dash
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.post(url, {
'action': 'Delete student state for module',
'unique_student_identifier': self.student.email,
'problem_for_student': problem_location.to_deprecated_string(),
})
self.assertEqual(response.status_code, 200)
# Verify that the student's scores have been reset in the submissions API
score = sub_api.get_score(student_item)
self.assertIs(score, None)
......@@ -263,67 +263,13 @@ function goto( mode)
%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
<H2>${_("Course-specific grade adjustment")}</h2>
<p>
${_("Specify a problem in the course here with its complete location:")}
<input type="text" name="problem_for_all_students" size="60">
</p>
## Translators: A location (string of text) follows this sentence.
<p>${_("You must provide the complete location of the problem. In the Staff Debug viewer, the location looks like this:")}<br/>
<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt></p>
<p>
${_("Then select an action:")}
<input type="submit" name="action" value="Reset ALL students' attempts">
<input type="submit" name="action" value="Rescore ALL students' problem submissions">
</p>
<p>
<p>${_("These actions run in the background, and status for active tasks will appear in a table below. To see status for all tasks submitted for this problem, click on this button:")}
</p>
<p>
<input type="submit" name="action" value="Show Background Task History">
</p>
<p>${_("To perform these actions, please visit the 'Student Admin' section of the instructor dashboard.")}</p>
<hr width="40%" style="align:left">
%endif
<h2>${_("Student-specific grade inspection and adjustment")}</h2>
<p>
${_("Specify the {platform_name} email address or username of a student here:").format(platform_name=settings.PLATFORM_NAME)}
<input type="text" name="unique_student_identifier">
</p>
<p>
${_("Click this, and a link to student's progress page will appear below:")}
<input type="submit" name="action" value="Get link to student's progress page">
</p>
<p>
${_("Specify a problem in the course here with its complete location:")}
<input type="text" name="problem_for_student" size="60">
</p>
## Translators: A location (string of text) follows this sentence.
<p>${_("You must provide the complete location of the problem. In the Staff Debug viewer, the location looks like this:")}<br/>
<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt></p>
<p>
${_("Then select an action:")}
<input type="submit" name="action" value="Reset student's attempts">
%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
<input type="submit" name="action" value="Rescore student's problem submission">
%endif
</p>
%if instructor_access:
<p>
${_("You may also delete the entire state of a student for the specified module:")}
<input type="submit" name="action" value="Delete student state for module">
</p>
%endif
%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
<p>${_("Rescoring runs in the background, and status for active tasks will appear in a table below. "
"To see status for all tasks submitted for this problem and student, click on this button:")}
</p>
<p>
<input type="submit" name="action" value="Show Background Task History for Student">
</p>
%endif
<p>${_("To perform these actions, please visit the 'Student Admin' section of the instructor dashboard.")}</p>
%endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment