Commit e05e35b0 by UmanShahzad

Revert `maximum_attempts` to `max_attempts`.

Found out that the relevant Davidson courses use plenty
of max_attempts, but no max_scores. Used `grep`.
parent 5a5f3f0c
......@@ -81,7 +81,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
scope=Scope.settings,
default=1.0,
)
maximum_attempts = Integer(
max_attempts = Integer(
display_name='Maximum attempts',
help='Defines the number of times a student can try to answer this problem. If the value '
'is not set, infinite attempts are allowed.',
......@@ -96,7 +96,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
'row_heights',
'default_tolerance',
'maximum_score',
'maximum_attempts',
'max_attempts',
]
# Dictionary mapping cell ids to the student answers.
......@@ -173,7 +173,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
score=self.score,
maximum_score=self.maximum_score,
attempts=self.attempts,
maximum_attempts=self.maximum_attempts,
max_attempts=self.max_attempts,
)
def student_view(self, context=None):
......@@ -188,7 +188,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
head_height=self._row_heights[0] if self._row_heights else None,
thead=self.thead,
tbody=self.tbody,
maximum_attempts=self.maximum_attempts,
max_attempts=self.max_attempts,
)
html = loader.render_template('templates/html/activetable.html', context)
......@@ -207,7 +207,7 @@ class ActiveTableXBlock(StudioEditableXBlockMixin, XBlock):
def check_and_save_answers(self, data):
"""Common implementation for the check and save handlers."""
if self.maximum_attempts and self.attempts >= self.maximum_attempts:
if self.max_attempts and self.attempts >= self.max_attempts:
# The "Check" button is hidden when the maximum number of attempts has been reached, so
# we can only get here by manually crafted requests. We simply return the current
# status without rechecking or storing the answers in that case.
......
......@@ -51,13 +51,13 @@ function ActiveTableXBlock(runtime, element, init_args) {
} else {
feedback_msg = '(' + data.score + '/' + data.maximum_score + ' points)';
}
if (data.maximum_attempts) {
feedback_msg = 'You have used ' + data.attempts + ' of ' + data.maximum_attempts +
if (data.max_attempts) {
feedback_msg = 'You have used ' + data.attempts + ' of ' + data.max_attempts +
' submissions ' + feedback_msg;
if (data.attempts == data.maximum_attempts - 1) {
if (data.attempts == data.max_attempts - 1) {
$('.action .check .check-label', element).text('Final check');
}
else if (data.attempts >= data.maximum_attempts) {
else if (data.attempts >= data.max_attempts) {
$('.action .check, .action .save', element).hide();
}
}
......
......@@ -41,7 +41,7 @@
<div class="status-message" aria-live="polite"></div>
<div class="action">
<button class="check"><span class="check-label">Check</span><span class="sr"> your answer</span></button>
{% if maximum_attempts %}
{% if max_attempts %}
<button class="save">Save<span class="sr"> your answer</span></button>
<div class="submission-feedback" aria-live="polite"></div>
{% endif %}
......
......@@ -81,7 +81,7 @@ class TestActiveTable(StudioEditableBaseTest):
def test_save_and_reload(self):
answers = dict(cell_1_1='1', cell_2_1='2', cell_3_1='3')
self.load_scenario('xml/maximum_attempts.xml')
self.load_scenario('xml/max_attempts.xml')
self.enter_answers(answers)
self.element.find_element_by_css_selector('.action button.save').click()
vertical = self.load_root_xblock()
......
<vertical_demo>
<activetable url_name="maximum_attempts" maximum_attempts="2">
<activetable url_name="max_attempts" max_attempts="2">
[
['Event', 'Year'],
['French Revolution', Numeric(answer=1789)],
......
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