Commit 4fdfcc02 by Stephen Sanchez

Merge pull request #399 from edx/sanchez/TIM-625-staff-debug-hide-ai-step

Sanchez/tim 625 staff debug hide ai step
parents 9a4de3a9 95b7f9b6
......@@ -387,6 +387,10 @@ def get_status_counts(course_id, item_id, steps):
]
"""
# The AI status exists for workflow logic, but no student will ever be in
# the AI status, so we should never return it.
statuses = steps + AssessmentWorkflow.STATUSES
if 'ai' in statuses: statuses.remove('ai')
return [
{
"status": status,
......@@ -396,7 +400,7 @@ def get_status_counts(course_id, item_id, steps):
item_id=item_id,
).count()
}
for status in steps + AssessmentWorkflow.STATUSES
for status in statuses
]
......
......@@ -197,17 +197,25 @@ class TestAssessmentWorkflowApi(CacheResetTest):
def test_get_status_counts(self):
# Initially, the counts should all be zero
counts = workflow_api.get_status_counts("test/1/1", "peer-problem", ["peer", "self"])
counts = workflow_api.get_status_counts(
"test/1/1",
"peer-problem",
["ai", "training", "peer", "self"]
)
self.assertEqual(counts, [
{"status": "training", "count": 0},
{"status": "peer", "count": 0},
{"status": "self", "count": 0},
{"status": "waiting", "count": 0},
{"status": "done", "count": 0},
])
self.assertFalse("ai" in [count['status'] for count in counts])
# Create assessments with each status
# We're going to cheat a little bit by using the model objects
# directly, since the API does not provide access to the status directly.
self._create_workflow_with_status("user 1", "test/1/1", "peer-problem", "training")
self._create_workflow_with_status("user 1", "test/1/1", "peer-problem", "peer")
self._create_workflow_with_status("user 2", "test/1/1", "peer-problem", "self")
self._create_workflow_with_status("user 3", "test/1/1", "peer-problem", "self")
......@@ -220,24 +228,39 @@ class TestAssessmentWorkflowApi(CacheResetTest):
self._create_workflow_with_status("user 10", "test/1/1", "peer-problem", "done")
# Now the counts should be updated
counts = workflow_api.get_status_counts("test/1/1", "peer-problem", ["peer", "self"])
counts = workflow_api.get_status_counts(
"test/1/1",
"peer-problem",
["ai", "training", "peer", "self"]
)
self.assertEqual(counts, [
{"status": "training", "count": 1},
{"status": "peer", "count": 1},
{"status": "self", "count": 2},
{"status": "waiting", "count": 3},
{"status": "done", "count": 4},
])
self.assertFalse("ai" in [count['status'] for count in counts])
# Create a workflow in a different course, same user and item
# Counts should be the same
self._create_workflow_with_status("user 1", "other_course", "peer-problem", "peer")
updated_counts = workflow_api.get_status_counts("test/1/1", "peer-problem", ["peer", "self"])
updated_counts = workflow_api.get_status_counts(
"test/1/1",
"peer-problem",
["ai", "training", "peer", "self"]
)
self.assertEqual(counts, updated_counts)
# Create a workflow in the same course, different item
# Counts should be the same
self._create_workflow_with_status("user 1", "test/1/1", "other problem", "peer")
updated_counts = workflow_api.get_status_counts("test/1/1", "peer-problem", ["peer", "self"])
updated_counts = workflow_api.get_status_counts(
"test/1/1",
"peer-problem",
["ai", "training", "peer", "self"]
)
self.assertEqual(counts, updated_counts)
def _create_workflow_with_status(self, student_id, course_id, item_id, status, answer="answer"):
......
......@@ -68,6 +68,9 @@ class StaffInfoMixin(object):
steps = ['submission'] + self.assessment_steps
for step in steps:
if step == 'example-based-assessment':
continue
# Get the dates as a student would see them
__, __, start_date, due_date = self.is_closed(step=step, course_staff=False)
......
......@@ -84,6 +84,14 @@
</criterion>
</rubric>
<assessments>
<assessment name="example-based-assessment" algorithm_id="fake">
<example>
<answer>Example Answer One</answer>
<select criterion="Form" option="Reddit" />
<select criterion="Clear-headed" option="Yogi Berra" />
<select criterion="Concise" option="HP Lovecraft" />
</example>
</assessment>
<assessment name="peer-assessment" must_grade="5" must_be_graded_by="3" start="2015-01-02" due="2015-04-01"/>
<assessment name="self-assessment" start="2016-01-02" due="2016-04-01"/>
</assessments>
......
......@@ -147,17 +147,21 @@ class TestCourseStaff(XBlockHandlerTestCase):
# Verify that we can render without error
resp = self.request(xblock, 'render_staff_info', json.dumps({}))
self.assertIn("course staff information", resp.decode('utf-8').lower())
decoded_response = resp.decode('utf-8').lower()
self.assertIn("course staff information", decoded_response)
# Confirm example-based-assessment does not show up; it is not date
# driven so its start / due dates are not relevant
self.assertNotIn("example-based-assessment", decoded_response)
# Check all release dates.
self.assertIn("march 1, 2014", resp.decode('utf-8').lower())
self.assertIn("jan. 2, 2015", resp.decode('utf-8').lower())
self.assertIn("jan. 2, 2016", resp.decode('utf-8').lower())
self.assertIn("march 1, 2014", decoded_response)
self.assertIn("jan. 2, 2015", decoded_response)
self.assertIn("jan. 2, 2016", decoded_response)
# Check all due dates.
self.assertIn("april 1, 2014", resp.decode('utf-8').lower())
self.assertIn("april 1, 2015", resp.decode('utf-8').lower())
self.assertIn("april 1, 2016", resp.decode('utf-8').lower())
self.assertIn("april 1, 2014", decoded_response)
self.assertIn("april 1, 2015", decoded_response)
self.assertIn("april 1, 2016", decoded_response)
@scenario('data/basic_scenario.xml', user_id='Bob')
def test_staff_debug_dates_distant_past_and_future(self, xblock):
......
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