Skip to content
Snippets Groups Projects
Commit efe250f9 authored by Vik Paruchuri's avatar Vik Paruchuri
Browse files

Fix logic, make better error messages

parent 9fd36056
No related branches found
Tags release-2020-11-25-04.25
No related merge requests found
......@@ -562,7 +562,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
self.send_to_grader(get['student_answer'], system)
self.change_state(self.ASSESSING)
else:
error_message = "There was a problem saving the image in your submission. Please try a different image."
error_message = "There was a problem saving the image in your submission. Please try a different image, or try pasting a link to an image into the answer box."
return {
'success': True,
......
......@@ -318,7 +318,7 @@ class OpenEndedChild(object):
and the html corresponding to the uploaded image
"""
has_file_to_upload = False
success = False
uploaded_to_s3 = False
image_tag = ""
if 'can_upload_files' in get_data:
if get_data['can_upload_files'] == 'true':
......@@ -327,8 +327,8 @@ class OpenEndedChild(object):
uploaded_to_s3, s3_public_url = self.upload_image_to_s3(file)
if uploaded_to_s3:
image_tag = self.generate_image_tag_from_url(s3_public_url, file.name)
success = True
return success, has_file_to_upload, uploaded_to_s3, image_tag
return has_file_to_upload, uploaded_to_s3, image_tag
def generate_image_tag_from_url(self, s3_public_url, image_name):
"""
......@@ -353,7 +353,7 @@ class OpenEndedChild(object):
#If the question does not accept file uploads, do not do anything
return True, get_data
success, has_file_to_upload, uploaded_to_s3, image_tag = self.check_for_image_and_upload(get_data)
has_file_to_upload, uploaded_to_s3, image_tag = self.check_for_image_and_upload(get_data)
if uploaded_to_s3 and has_file_to_upload:
get_data['student_answer'] += image_tag
overall_success = True
......
......@@ -210,7 +210,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING)
else:
error_message = "There was a problem saving the image in your submission. Please try a different image."
error_message = "There was a problem saving the image in your submission. Please try a different image, or try pasting a link to an image into the answer box."
return {
'success': success,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment