Commit 94aeb71e by Will Daly

Merge branch 'master' into ai-grading

Conflicts:
	apps/openassessment/xblock/test/data/invalid_rubrics.json
	apps/openassessment/xblock/test/data/valid_rubrics.json
	apps/openassessment/xblock/test/test_message.py
parents 15394871 860b28fd
......@@ -388,6 +388,136 @@
"is_released": true
},
"rename_criterion_name_after_release": {
"rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Changed criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
}
]
},
"current_rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Test criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
}
]
},
"is_released": true
},
"rename_multiple_criteria_after_release": {
"rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Test criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
},
{
"order_num": 1,
"name": "Another criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
}
]
}
]
},
"current_rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Renamed Test Criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
},
{
"order_num": 1,
"name": "Renamed Another criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
}
]
}
]
},
"is_released": true
},
"example_based_duplicate_option_points": {
"is_example_based": true,
"rubric": {
......
......@@ -442,58 +442,6 @@
"is_released": true
},
"change_criteria_name_after_release": {
"rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Changed criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
}
]
},
"current_rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Test criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
}
]
},
"is_released": true
},
"change_option_name_after_release": {
"rubric": {
"prompt": "Test Prompt",
......@@ -598,84 +546,6 @@
"is_released": true
},
"rename_criteria_after_release": {
"rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Test criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
},
{
"order_num": 1,
"name": "Another criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
}
]
}
]
},
"current_rubric": {
"prompt": "Test Prompt",
"criteria": [
{
"order_num": 0,
"name": "Renamed Test Criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
},
{
"order_num": 1,
"points": 2,
"name": "Yes",
"explanation": "Yes explanation"
}
]
},
{
"order_num": 1,
"name": "Renamed Another criterion",
"prompt": "Test criterion prompt",
"options": [
{
"order_num": 0,
"points": 0,
"name": "No",
"explanation": "No explanation"
}
]
}
]
},
"is_released": true
},
"rename_options_after_release": {
"rubric": {
"prompt": "Test Prompt",
......
......@@ -21,8 +21,7 @@ class TestMessageRender(XBlockHandlerTestCase):
# Sets up all of the pre-set dates. Uses base day of today in order to allow
# comparison regardless of true date. For this reason, the dates in the XML are
# ignored and irrelevant (because we patch is_closed)
TODAY = dt.date.today()
TODAY = dt.datetime(TODAY.year, TODAY.month, TODAY.day, 0, 0, 0, tzinfo=pytz.utc)
TODAY = dt.datetime.utcnow().replace(tzinfo=pytz.utc)
TOMORROW = TODAY + dt.timedelta(days=1)
FUTURE = TODAY + dt.timedelta(days=10)
FAR_FUTURE = TODAY + dt.timedelta(days=100)
......@@ -92,10 +91,6 @@ class TestMessageRender(XBlockHandlerTestCase):
# Sets the side effect of is_closed to be our custom method, completing the patch
mock_is_closed.side_effect = closed_side_effect
# self.request(xblock, 'render_message', )
#from nose.tools import set_trace; set_trace()
xblock.render_message(None, '')
# Asserts that the message_mixin correctly derived the path and context to be rendered
......@@ -861,4 +856,3 @@ class TestMessageRender(XBlockHandlerTestCase):
xblock, expected_path, expected_context,
status, deadline_information, has_peers_to_grade
)
......@@ -199,6 +199,19 @@ def validate_rubric(rubric_dict, current_rubric, is_released, is_example_based):
if len(rubric_dict['criteria']) != len(current_rubric['criteria']):
return (False, _(u'The number of criteria cannot be changed after a problem is released.'))
# Criteria names must be the same
# We use criteria names as unique identifiers (unfortunately)
# throughout the system. Changing them mid-flight can cause
# the grade page, for example, to raise 500 errors.
# When we implement non-XML authoring, we might be able to fix this
# the right way by assigning unique identifiers for criteria;
# but for now, this is the safest way to avoid breaking problems
# post-release.
current_criterion_names = set(criterion.get('name') for criterion in current_rubric['criteria'])
new_criterion_names = set(criterion.get('name') for criterion in rubric_dict['criteria'])
if current_criterion_names != new_criterion_names:
return (False, u'Criteria names cannot be changed after a problem is released')
# Number of options for each criterion must be the same
for new_criterion, old_criterion in _match_by_order(rubric_dict['criteria'], current_rubric['criteria']):
if len(new_criterion['options']) != len(old_criterion['options']):
......
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