Commit 24bfe440 by Vik Paruchuri

Some restyling, automatically check for feedback, remove reload button

parent 5273d447
......@@ -24,12 +24,12 @@ section.combined-open-ended {
.status-container
{
float:right;
width:30%;
width:40%;
}
.item-container
{
float:left;
width: 63%;
width: 53%;
}
&:after
......@@ -68,8 +68,8 @@ section.open-ended-child, section.combined-open-ended-status {
}
.feedback-on-feedback {
height: 100px;
width: 150px;
height: 150px;
width: 250px;
margin-right: 0px;
}
......
......@@ -35,7 +35,6 @@ class @CombinedOpenEnded
@child_state = @el.data('state')
@child_type = @el.data('child-type')
if @child_type=="openended"
@reload_button = @$('.reload-button')
@skip_button = @$('.skip-button')
@skip_button.click @skip_post_assessment
......@@ -58,7 +57,6 @@ class @CombinedOpenEnded
@next_problem_button.hide()
@hint_area.attr('disabled', false)
if @child_type=="openended"
@reload_button.hide()
@skip_button.hide()
if @child_state == 'initial'
@answer_area.attr("disabled", false)
......@@ -70,10 +68,9 @@ class @CombinedOpenEnded
@submit_button.click @save_assessment
if @child_type == "openended"
@submit_button.hide()
@reload_button.show()
@queueing()
else if @child_state == 'post_assessment'
if @child_type=="openended"
@reload_button.hide()
@skip_button.show()
@skip_post_assessment()
@answer_area.attr("disabled", true)
......@@ -237,4 +234,18 @@ class @CombinedOpenEnded
@el.find('.open-ended-alert').remove()
alert_elem = "<div class='open-ended-alert'>" + msg + "</div>"
@el.find('.open-ended-action').after(alert_elem)
@el.find('.open-ended-alert').css(opacity: 0).animate(opacity: 1, 700)
\ No newline at end of file
@el.find('.open-ended-alert').css(opacity: 0).animate(opacity: 1, 700)
queueing: =>
if @child_state=="assessing" and @child_type=="openended"
if window.queuePollerID # Only one poller 'thread' per Problem
window.clearTimeout(window.queuePollerID)
window.queuePollerID = window.setTimeout(@poll, 10000)
poll: =>
$.postWithPrefix "#{@ajax_url}/check_for_score", (response) =>
if response.state == "done" or response.state=="post_assessment"
delete window.queuePollerID
location.reload()
else
window.queuePollerID = window.setTimeout(@poll, 10000)
\ No newline at end of file
......@@ -405,7 +405,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
return correct
def format_feedback_with_evaluation(self,feedback):
context={'msg' : feedback, 'id' : "1", 'rows' : 30, 'cols' : 30}
context={'msg' : feedback, 'id' : "1", 'rows' : 50, 'cols' : 50}
html= render_to_string('open_ended_evaluation.html', context)
return html
......@@ -424,6 +424,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
'score_update': self.update_score,
'save_post_assessment' : self.message_post,
'skip_post_assessment' : self.skip_post_assessment,
'check_for_score' : self.check_for_score,
}
if dispatch not in handlers:
......@@ -438,6 +439,10 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
})
return json.dumps(d, cls=ComplexEncoder)
def check_for_score(self, get, system):
state = self.state
return {'state' : state}
def save_answer(self, get, system):
if self.attempts > self.max_attempts:
# If too many attempts, prevent student from saving answer and
......
......@@ -29,7 +29,6 @@
<span id="answer_${id}"></span>
<input name="reload" class="reload-button" type="button" value="Recheck for Feedback" onclick="document.location.reload(true);" />
<div class="external-grader-message">
${msg|n}
</div>
......
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