Commit a04881ce by brianhw

Merge pull request #1740 from MITx/fix/vik/peer-image-grading

Fix/vik/peer image grading
parents 8905343f 7101c760
...@@ -24,7 +24,7 @@ MAX_ATTEMPTS = 1 ...@@ -24,7 +24,7 @@ MAX_ATTEMPTS = 1
MAX_SCORE = 1 MAX_SCORE = 1
#The highest score allowed for the overall xmodule and for each rubric point #The highest score allowed for the overall xmodule and for each rubric point
MAX_SCORE_ALLOWED = 3 MAX_SCORE_ALLOWED = 50
#If true, default behavior is to score module as a practice problem. Otherwise, no grade at all is shown in progress #If true, default behavior is to score module as a practice problem. Otherwise, no grade at all is shown in progress
#Metadata overrides this. #Metadata overrides this.
...@@ -363,7 +363,15 @@ class CombinedOpenEndedV1Module(): ...@@ -363,7 +363,15 @@ class CombinedOpenEndedV1Module():
""" """
self.update_task_states() self.update_task_states()
html = self.current_task.get_html(self.system) html = self.current_task.get_html(self.system)
return_html = html
try:
#Without try except block, get this error:
# File "/home/vik/mitx_all/mitx/common/lib/xmodule/xmodule/x_module.py", line 263, in rewrite_content_links
# if link.startswith(XASSET_SRCREF_PREFIX):
# Placing try except so that if the error is fixed, this code will start working again.
return_html = rewrite_links(html, self.rewrite_content_links) return_html = rewrite_links(html, self.rewrite_content_links)
except:
pass
return return_html return return_html
def get_current_attributes(self, task_number): def get_current_attributes(self, task_number):
...@@ -782,7 +790,7 @@ class CombinedOpenEndedV1Descriptor(): ...@@ -782,7 +790,7 @@ class CombinedOpenEndedV1Descriptor():
template_dir_name = "combinedopenended" template_dir_name = "combinedopenended"
def __init__(self, system): def __init__(self, system):
self.system =system self.system = system
@classmethod @classmethod
def definition_from_xml(cls, xml_object, system): def definition_from_xml(cls, xml_object, system):
......
...@@ -36,7 +36,7 @@ ALLOWABLE_IMAGE_SUFFIXES = [ ...@@ -36,7 +36,7 @@ ALLOWABLE_IMAGE_SUFFIXES = [
] ]
#Maximum allowed dimensions (x and y) for an uploaded image #Maximum allowed dimensions (x and y) for an uploaded image
MAX_ALLOWED_IMAGE_DIM = 1500 MAX_ALLOWED_IMAGE_DIM = 2000
#Dimensions to which image is resized before it is evaluated for color count, etc #Dimensions to which image is resized before it is evaluated for color count, etc
MAX_IMAGE_DIM = 150 MAX_IMAGE_DIM = 150
...@@ -178,7 +178,7 @@ class URLProperties(object): ...@@ -178,7 +178,7 @@ class URLProperties(object):
Runs all available url tests Runs all available url tests
@return: True if URL passes tests, false if not. @return: True if URL passes tests, false if not.
""" """
url_is_okay = self.check_suffix() and self.check_if_parses() and self.check_domain() url_is_okay = self.check_suffix() and self.check_if_parses()
return url_is_okay return url_is_okay
def check_domain(self): def check_domain(self):
......
...@@ -357,10 +357,6 @@ class OpenEndedChild(object): ...@@ -357,10 +357,6 @@ class OpenEndedChild(object):
if get_data['can_upload_files'] in ['true', '1']: if get_data['can_upload_files'] in ['true', '1']:
has_file_to_upload = True has_file_to_upload = True
file = get_data['student_file'][0] file = get_data['student_file'][0]
if self.system.track_fuction:
self.system.track_function('open_ended_image_upload', {'filename': file.name})
else:
log.info("No tracking function found when uploading image.")
uploaded_to_s3, image_ok, s3_public_url = self.upload_image_to_s3(file) uploaded_to_s3, image_ok, s3_public_url = self.upload_image_to_s3(file)
if uploaded_to_s3: if uploaded_to_s3:
image_tag = self.generate_image_tag_from_url(s3_public_url, file.name) image_tag = self.generate_image_tag_from_url(s3_public_url, file.name)
......
...@@ -209,9 +209,6 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours ...@@ -209,9 +209,6 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours
'waittime': settings.XQUEUE_WAITTIME_BETWEEN_REQUESTS 'waittime': settings.XQUEUE_WAITTIME_BETWEEN_REQUESTS
} }
def get_or_default(key, default):
getattr(settings, key, default)
#This is a hacky way to pass settings to the combined open ended xmodule #This is a hacky way to pass settings to the combined open ended xmodule
#It needs an S3 interface to upload images to S3 #It needs an S3 interface to upload images to S3
#It needs the open ended grading interface in order to get peer grading to be done #It needs the open ended grading interface in order to get peer grading to be done
...@@ -227,12 +224,11 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours ...@@ -227,12 +224,11 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours
open_ended_grading_interface['mock_staff_grading'] = settings.MOCK_STAFF_GRADING open_ended_grading_interface['mock_staff_grading'] = settings.MOCK_STAFF_GRADING
if is_descriptor_combined_open_ended: if is_descriptor_combined_open_ended:
s3_interface = { s3_interface = {
'access_key' : get_or_default('AWS_ACCESS_KEY_ID',''), 'access_key' : getattr(settings,'AWS_ACCESS_KEY_ID',''),
'secret_access_key' : get_or_default('AWS_SECRET_ACCESS_KEY',''), 'secret_access_key' : getattr(settings,'AWS_SECRET_ACCESS_KEY',''),
'storage_bucket_name' : get_or_default('AWS_STORAGE_BUCKET_NAME','') 'storage_bucket_name' : getattr(settings,'AWS_STORAGE_BUCKET_NAME','openended')
} }
def inner_get_module(descriptor): def inner_get_module(descriptor):
""" """
Delegate to get_module. It does an access check, so may return None Delegate to get_module. It does an access check, so may return None
......
...@@ -111,7 +111,7 @@ def peer_grading(request, course_id): ...@@ -111,7 +111,7 @@ def peer_grading(request, course_id):
#Get the peer grading modules currently in the course #Get the peer grading modules currently in the course
items = modulestore().get_items(['i4x', None, course_id_parts[1], 'peergrading', None]) items = modulestore().get_items(['i4x', None, course_id_parts[1], 'peergrading', None])
#See if any of the modules are centralized modules (ie display info from multiple problems) #See if any of the modules are centralized modules (ie display info from multiple problems)
items = [i for i in items if i.metadata.get("use_for_single_location", True) in false_dict] items = [i for i in items if getattr(i,"use_for_single_location", True) in false_dict]
#Get the first one #Get the first one
item_location = items[0].location item_location = items[0].location
#Generate a url for the first module and redirect the user to it #Generate a url for the first module and redirect the user to it
......
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