Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
d0e30e1d
Commit
d0e30e1d
authored
May 28, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #363 from edx/will/TIM-574-take-2
Validation: cannot rename criteria post-release
parents
10df7db7
d57d3553
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
132 deletions
+143
-132
apps/openassessment/xblock/test/data/invalid_rubrics.json
+130
-0
apps/openassessment/xblock/test/data/valid_rubrics.json
+0
-132
apps/openassessment/xblock/validation.py
+13
-0
No files found.
apps/openassessment/xblock/test/data/invalid_rubrics.json
View file @
d0e30e1d
...
...
@@ -396,5 +396,135 @@
]
},
"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
}
}
apps/openassessment/xblock/test/data/valid_rubrics.json
View file @
d0e30e1d
...
...
@@ -294,9 +294,7 @@
}
]
},
"current_rubric"
:
null
,
"is_released"
:
false
},
"remove_options_before_release"
:
{
...
...
@@ -449,58 +447,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"
,
...
...
@@ -605,84 +551,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"
,
...
...
apps/openassessment/xblock/validation.py
View file @
d0e30e1d
...
...
@@ -177,6 +177,19 @@ def validate_rubric(rubric_dict, current_rubric, is_released):
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'
]):
...
...
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