diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py
index 5092e5c378..ea60b3b7bd 100644
--- a/common/lib/capa/capa/inputtypes.py
+++ b/common/lib/capa/capa/inputtypes.py
@@ -307,7 +307,18 @@ def filesubmission(element, value, status, render_template, msg=''):
Upload a single file (e.g. for programming assignments)
'''
eid = element.get('id')
- context = { 'id': eid, 'state': status, 'msg': msg, 'value': value, }
+
+ # Check if problem has been queued
+ queued = ''
+ queue_len = 0
+ if status == 'incomplete': # Flag indicating that the problem has been queued, 'msg' is length of queue
+ queued = 'true'
+ queue_len = msg
+ msg = 'Submitted to grader. (Queue length: %s)' % queue_len
+
+ context = { 'id': eid, 'state': status, 'msg': msg, 'value': value,
+ 'queued': queued, 'queue_len': queue_len
+ }
html = render_template("filesubmission.html", context)
return etree.XML(html)
@@ -329,10 +340,18 @@ def textbox(element, value, status, render_template, msg=''):
hidden = element.get('hidden', '') # if specified, then textline is hidden and id is stored in div of name given by hidden
if not value: value = element.text # if no student input yet, then use the default input given by the problem
+
+ # Check if problem has been queued
+ queued = ''
+ queue_len = 0
+ if status == 'incomplete': # Flag indicating that the problem has been queued, 'msg' is length of queue
+ queued = 'true'
+ queue_len = msg
+ msg = 'Submitted to grader. (Queue length: %s)' % queue_len
# For CodeMirror
- mode = element.get('mode') or 'python' # mode, eg "python" or "xml"
- linenumbers = element.get('linenumbers','true') # for CodeMirror
+ mode = element.get('mode','python')
+ linenumbers = element.get('linenumbers','true')
tabsize = element.get('tabsize','4')
tabsize = int(tabsize)
@@ -340,6 +359,7 @@ def textbox(element, value, status, render_template, msg=''):
'mode': mode, 'linenumbers': linenumbers,
'rows': rows, 'cols': cols,
'hidden': hidden, 'tabsize': tabsize,
+ 'queued': queued, 'queue_len': queue_len,
}
html = render_template("textbox.html", context)
try:
diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py
index 66212f1e87..25b99fc00a 100644
--- a/common/lib/capa/capa/responsetypes.py
+++ b/common/lib/capa/capa/responsetypes.py
@@ -898,7 +898,7 @@ class CodeResponse(LoncapaResponse):
'processor': self.code,
}
- # Submit request
+ # Submit request. When successful, 'msg' is the prior length of the queue
if is_file(submission):
contents.update({'edX_student_response': submission.name})
(error, msg) = qinterface.send_to_queue(header=xheader,
@@ -914,8 +914,11 @@ class CodeResponse(LoncapaResponse):
cmap.set(self.answer_id, queuekey=None,
msg='Unable to deliver your submission to grader. (Reason: %s.) Please try again later.' % msg)
else:
- # Non-null CorrectMap['queuekey'] indicates that the problem has been queued
- cmap.set(self.answer_id, queuekey=queuekey, msg='Submitted to grader. (Queue length: %s)' % msg)
+ # Queueing mechanism flags:
+ # 1) Backend: Non-null CorrectMap['queuekey'] indicates that the problem has been queued
+ # 2) Frontend: correctness='incomplete' eventually trickles down through inputtypes.textbox
+ # and .filesubmission to inform the browser to poll the LMS
+ cmap.set(self.answer_id, queuekey=queuekey, correctness='incomplete', msg=msg)
return cmap
diff --git a/common/lib/capa/capa/templates/filesubmission.html b/common/lib/capa/capa/templates/filesubmission.html
index ff9fc992fd..09bc287923 100644
--- a/common/lib/capa/capa/templates/filesubmission.html
+++ b/common/lib/capa/capa/templates/filesubmission.html
@@ -9,6 +9,9 @@
% elif state == 'incomplete':
% endif
+ % if queued:
+ ${queue_len}
+ % endif
(${state})
diff --git a/common/lib/capa/capa/templates/textbox.html b/common/lib/capa/capa/templates/textbox.html
index f201bd6947..f31b98b580 100644
--- a/common/lib/capa/capa/templates/textbox.html
+++ b/common/lib/capa/capa/templates/textbox.html
@@ -19,6 +19,9 @@
% if hidden: