Javascript state transitions
This commit is contained in:
@@ -57,8 +57,10 @@ class @CombinedOpenEnded
|
||||
@answer_area.attr("disabled", true)
|
||||
@hint_area.attr('disabled', true)
|
||||
@submit_button.hide()
|
||||
if !@state == 'done'
|
||||
if @state != 'done'
|
||||
@next_problem_button.show()
|
||||
else
|
||||
@next_problem_button.hide()
|
||||
if @state == 'done'
|
||||
if @allow_reset
|
||||
@reset_button.show()
|
||||
@@ -138,6 +140,7 @@ class @CombinedOpenEnded
|
||||
@child_state = 'initial'
|
||||
@rebind()
|
||||
@reset_button.hide()
|
||||
location.reload()
|
||||
else
|
||||
@errors_area.html(response.error)
|
||||
else
|
||||
@@ -156,6 +159,7 @@ class @CombinedOpenEnded
|
||||
@child_state = 'initial'
|
||||
@rebind()
|
||||
@reset_button.hide()
|
||||
location.reload()
|
||||
else
|
||||
@errors_area.html(response.error)
|
||||
else
|
||||
|
||||
@@ -466,14 +466,14 @@ class SelfAssessmentModule():
|
||||
Returns {'success': bool, 'error': msg}
|
||||
(error only present if not success)
|
||||
"""
|
||||
if self.state != self.DONE:
|
||||
return self.out_of_sync_error(get)
|
||||
#if self.state != self.DONE:
|
||||
# return self.out_of_sync_error(get)
|
||||
|
||||
if self.attempts > self.max_attempts:
|
||||
return {
|
||||
'success': False,
|
||||
'error': 'Too many attempts.'
|
||||
}
|
||||
#if self.attempts > self.max_attempts:
|
||||
# return {
|
||||
# 'success': False,
|
||||
# 'error': 'Too many attempts.'
|
||||
# }
|
||||
self.change_state(self.INITIAL)
|
||||
return {'success': True}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user