Skip to content

Commit

Permalink
Merge pull request #618 from njdup/master
Browse files Browse the repository at this point in the history
Instructors can edit default response feedback text
  • Loading branch information
Stephen Sanchez committed Aug 22, 2014
2 parents 5c6ee6b + 75ff564 commit c092348
Show file tree
Hide file tree
Showing 21 changed files with 366 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,17 @@ <h6>
{% trans "Encourage your students to provide feedback on the response they've graded. You can replace the sample text with your own." %}
</p>
</li>
<li class="field comp-setting-entry">
<div class="wrapper-comp-setting" id="openassessment_rubric_feedback_default_text_input_wrapper">
<label for="openassessment_rubric_feedback_default_text" class="setting-label"> {% trans "Default Feedback Text" %}</label>
<textarea id="openassessment_rubric_feedback_default_text" class="input setting-input">{{ feedback_default_text }}</textarea>
</div>
<p class="setting-help">
{% trans "Enter feedback text that students will see before they enter their own feedback. Use this text to show students a good example peer assessment." %}
</p>
</li>

</ul>
</div>
</div>
{% endspaceless %}
{% endspaceless %}
4 changes: 2 additions & 2 deletions openassessment/templates/openassessmentblock/oa_rubric.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ <h4 class="question__title ui-toggle-visibility__control">
<div class="wrapper--input">
<textarea
id="assessment__rubric__question--feedback__value"
placeholder="{% trans "I noticed that this response..." %}"
placeholder="{{ rubric_feedback_default_text }}"
maxlength="500"
>
</textarea>
</div>
</li>
</ol>
</fieldset>
{% endspaceless %}
{% endspaceless %}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4 class="question__title ui-toggle-visibility__control">
<div class="wrapper--input">
<textarea
id="assessment__rubric__question--feedback__value"
placeholder="{% trans "I noticed that this response..." %}"
placeholder="{{ rubric_feedback_default_text }}"
maxlength="500"
>
</textarea>
Expand Down
6 changes: 6 additions & 0 deletions openassessment/xblock/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
(Optional) What aspects of this response stood out to you? What did it do well? How could it improve?
"""

# The rubric's feedback text is the default text displayed and used as
# the student's response to the feedback prompt
DEFAULT_RUBRIC_FEEDBACK_TEXT = """
I noticed that this response...
"""

DEFAULT_EXAMPLE_ANSWER = (
"Replace this text with your own sample response for this assignment. "
"Then, under Response Score to the right, select an option for each criterion. "
Expand Down
7 changes: 7 additions & 0 deletions openassessment/xblock/openassessmentblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ class OpenAssessmentBlock(
help="The rubric feedback prompt displayed to the student"
)

rubric_feedback_default_text = String(
default=DEFAULT_RUBRIC_FEEDBACK_TEXT,
scope=Scope.content,
help="The default rubric feedback text displayed to the student"
)

rubric_assessments = List(
default=DEFAULT_ASSESSMENT_MODULES,
scope=Scope.content,
Expand Down Expand Up @@ -386,6 +392,7 @@ def parse_xml(cls, node, runtime, keys, id_generator):

block.rubric_criteria = config['rubric_criteria']
block.rubric_feedback_prompt = config['rubric_feedback_prompt']
block.rubric_feedback_default_text = config['rubric_feedback_default_text']
block.rubric_assessments = config['rubric_assessments']
block.submission_start = config['submission_start']
block.submission_due = config['submission_due']
Expand Down
10 changes: 10 additions & 0 deletions openassessment/xblock/peer_assessment_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
PeerAssessmentRequestError, PeerAssessmentInternalError, PeerAssessmentWorkflowError
)
from openassessment.workflow.errors import AssessmentWorkflowError
from openassessment.xblock.defaults import DEFAULT_RUBRIC_FEEDBACK_TEXT
from .data_conversion import create_rubric_dict
from .resolve_dates import DISTANT_FUTURE
from .data_conversion import clean_criterion_feedback
Expand Down Expand Up @@ -130,6 +131,12 @@ def render_peer_assessment(self, data, suffix=''):
return Response(u"")
continue_grading = data.params.get('continue_grading', False)
path, context_dict = self.peer_path_and_context(continue_grading)

# For backwards compatibility, if no feedback default text has been
# set, use the default text
if 'rubric_feedback_default_text' not in context_dict:
context_dict['rubric_feedback_default_text'] = DEFAULT_RUBRIC_FEEDBACK_TEXT

return self.render_assessment(path, context_dict)

def peer_path_and_context(self, continue_grading):
Expand All @@ -155,6 +162,9 @@ def peer_path_and_context(self, continue_grading):
if self.rubric_feedback_prompt is not None:
context_dict["rubric_feedback_prompt"] = self.rubric_feedback_prompt

if self.rubric_feedback_default_text is not None:
context_dict['rubric_feedback_default_text'] = self.rubric_feedback_default_text

# We display the due date whether the problem is open or closed.
# If no date is set, it defaults to the distant future, in which
# case we don't display the date.
Expand Down
3 changes: 2 additions & 1 deletion openassessment/xblock/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def datetime_validator(value):
Required('prompt'): utf8_validator,
Required('title'): utf8_validator,
Required('feedback_prompt'): utf8_validator,
Required('feedback_default_text'): utf8_validator,
Required('submission_start'): Any(datetime_validator, None),
Required('submission_due'): Any(datetime_validator, None),
Required('allow_file_upload'): bool,
Expand Down Expand Up @@ -123,4 +124,4 @@ def datetime_validator(value):
]
})
]
})
})
2 changes: 1 addition & 1 deletion openassessment/xblock/static/js/openassessment-lms.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions openassessment/xblock/static/js/openassessment-studio.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions openassessment/xblock/static/js/spec/oa_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe("OpenAssessment.Server", function() {

var PROMPT = "Hello this is the prompt yes.";
var FEEDBACK_PROMPT = "Prompt for feedback";
var FEEDBACK_DEFAULT_TEXT = "Default feedback response text";

var RUBRIC = '<rubric>'+
'<criterion>'+
Expand Down Expand Up @@ -234,6 +235,7 @@ describe("OpenAssessment.Server", function() {
server.updateEditorContext({
prompt: PROMPT,
feedbackPrompt: FEEDBACK_PROMPT,
feedback_default_text: FEEDBACK_DEFAULT_TEXT,
title: TITLE,
submissionStart: SUBMISSION_START,
submissionDue: SUBMISSION_DUE,
Expand All @@ -248,6 +250,7 @@ describe("OpenAssessment.Server", function() {
data: JSON.stringify({
prompt: PROMPT,
feedback_prompt: FEEDBACK_PROMPT,
feedback_default_text: FEEDBACK_DEFAULT_TEXT,
title: TITLE,
submission_start: SUBMISSION_START,
submission_due: SUBMISSION_DUE,
Expand Down
2 changes: 2 additions & 0 deletions openassessment/xblock/static/js/src/oa_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ if (typeof OpenAssessment.Server == "undefined" || !OpenAssessment.Server) {
title (string): The title of the problem.
prompt (string): The question prompt.
feedbackPrompt (string): The directions to the student for giving overall feedback on a submission.
feedback_default_text (string): The default feedback text used as the student's feedback response
submissionStart (ISO-formatted datetime string or null): The start date of the submission.
submissionDue (ISO-formatted datetime string or null): The date the submission is due.
criteria (list of object literals): The rubric criteria.
Expand All @@ -430,6 +431,7 @@ if (typeof OpenAssessment.Server == "undefined" || !OpenAssessment.Server) {
var payload = JSON.stringify({
prompt: kwargs.prompt,
feedback_prompt: kwargs.feedbackPrompt,
feedback_default_text: kwargs.feedback_default_text,
title: kwargs.title,
submission_start: kwargs.submissionStart,
submission_due: kwargs.submissionDue,
Expand Down
1 change: 1 addition & 0 deletions openassessment/xblock/static/js/src/studio/oa_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ OpenAssessment.StudioView.prototype = {
this.server.updateEditorContext({
prompt: view.promptView.promptText(),
feedbackPrompt: view.rubricView.feedbackPrompt(),
feedback_default_text: view.rubricView.feedback_default_text(),
criteria: view.rubricView.criteriaDefinition(),
title: view.settingsView.displayName(),
submissionStart: view.settingsView.submissionStart(),
Expand Down
17 changes: 17 additions & 0 deletions openassessment/xblock/static/js/src/studio/oa_edit_rubric.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ OpenAssessment.EditRubricView.prototype = {
return OpenAssessment.Fields.stringField(sel, text);
},

/**
Get or set the default feedback response text in the editor.
The text is used as a student's default response to the feedback
prompt.
Args:
text (string, option): If provided, sets the default text to this value.
Returns:
string
**/
feedback_default_text: function(text) {
var sel = $("#openassessment_rubric_feedback_default_text", this.element);
return OpenAssessment.Fields.stringField(sel, text);
},

/**
Add a new criterion to the rubric.
Uses a client-side template to create the new criterion.
Expand Down
5 changes: 4 additions & 1 deletion openassessment/xblock/static/xml/example_based_example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
<feedbackprompt>
(Optional) What aspects of this response stood out to you? What did it do well? How could it improve?
</feedbackprompt>
<feedback_default_text>
I noticed that this response...
</feedback_default_text>
</rubric>
</openassessment>
</openassessment>
10 changes: 9 additions & 1 deletion openassessment/xblock/studio_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from xblock.core import XBlock
from xblock.fields import List, Scope
from xblock.fragment import Fragment
from openassessment.xblock.defaults import DEFAULT_EDITOR_ASSESSMENTS_ORDER
from openassessment.xblock.defaults import DEFAULT_EDITOR_ASSESSMENTS_ORDER, DEFAULT_RUBRIC_FEEDBACK_TEXT
from openassessment.xblock.validation import validator
from openassessment.xblock.data_conversion import create_rubric_dict, make_django_template_key
from openassessment.xblock.schema import EDITOR_UPDATE_SCHEMA
Expand Down Expand Up @@ -105,6 +105,12 @@ def editor_context(self):
if not criteria:
criteria = self.DEFAULT_CRITERIA

# To maintain backwards compatibility, if there is no
# feedback_default_text configured for the xblock, use the default text
feedback_default_text = copy.deepcopy(self.rubric_feedback_default_text)
if not feedback_default_text:
feedback_default_text = DEFAULT_RUBRIC_FEEDBACK_TEXT

return {
'prompt': self.prompt,
'title': self.title,
Expand All @@ -113,6 +119,7 @@ def editor_context(self):
'assessments': assessments,
'criteria': criteria,
'feedbackprompt': self.rubric_feedback_prompt,
'feedback_default_text': feedback_default_text,
'allow_file_upload': self.allow_file_upload,
'leaderboard_show': self.leaderboard_show,
'editor_assessments_order': [
Expand Down Expand Up @@ -202,6 +209,7 @@ def update_editor_context(self, data, suffix=''):
self.rubric_assessments = data['assessments']
self.editor_assessments_order = data['editor_assessments_order']
self.rubric_feedback_prompt = data['feedback_prompt']
self.rubric_feedback_default_text = data['feedback_default_text']
self.submission_start = data['submission_start']
self.submission_due = data['submission_due']
self.allow_file_upload = bool(data['allow_file_upload'])
Expand Down
Loading

0 comments on commit c092348

Please sign in to comment.