Render to string fix, display ETA message when student submits
This commit is contained in:
@@ -663,17 +663,21 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
|
||||
Output: Rendered HTML
|
||||
"""
|
||||
#set context variables and render template
|
||||
eta_string = None
|
||||
if self.state != self.INITIAL:
|
||||
latest = self.latest_answer()
|
||||
previous_answer = latest if latest is not None else self.initial_display
|
||||
post_assessment = self.latest_post_assessment(system)
|
||||
score = self.latest_score()
|
||||
correct = 'correct' if self.is_submission_correct(score) else 'incorrect'
|
||||
if self.state == self.ASSESSING:
|
||||
eta_string = self.get_eta()
|
||||
else:
|
||||
post_assessment = ""
|
||||
correct = ""
|
||||
previous_answer = self.initial_display
|
||||
|
||||
|
||||
context = {
|
||||
'prompt': self.prompt,
|
||||
'previous_answer': previous_answer,
|
||||
@@ -686,6 +690,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
|
||||
'child_type': 'openended',
|
||||
'correct': correct,
|
||||
'accept_file_upload': self.accept_file_upload,
|
||||
'eta_message' : eta_string,
|
||||
}
|
||||
html = system.render_template('open_ended.html', context)
|
||||
return html
|
||||
|
||||
@@ -23,6 +23,7 @@ from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore import search
|
||||
|
||||
from django.http import HttpResponse, Http404, HttpResponseRedirect
|
||||
from mitxmako.shortcuts import render_to_string
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -15,7 +15,12 @@
|
||||
% elif state in ['done', 'post_assessment'] and correct == 'incorrect':
|
||||
<span class="incorrect" id="status_${id}"></span> <p>Incorrect. </p>
|
||||
% elif state == 'assessing':
|
||||
<span class="grading" id="status_${id}">Submitted for grading.</span>
|
||||
<span class="grading" id="status_${id}">Submitted for grading.
|
||||
% if eta_message is not None:
|
||||
${eta_message}
|
||||
% endif
|
||||
</span>
|
||||
|
||||
% endif
|
||||
|
||||
% if hidden:
|
||||
|
||||
Reference in New Issue
Block a user