Commit 800bb96f by Waheed Ahmed

Merge pull request #2059 from edx/waheed/ora202-self-assessment-deadlines-not-apply-on-rubrics

Fixed self assessment deadlines don't apply to the submission of the rubric
parents fa6c8770 8e36dfed
...@@ -452,7 +452,7 @@ class @CombinedOpenEnded ...@@ -452,7 +452,7 @@ class @CombinedOpenEnded
@rebind() @rebind()
else else
@errors_area.html(response.error) @gentle_alert response.error
else else
@errors_area.html(@out_of_sync_message) @errors_area.html(@out_of_sync_message)
......
...@@ -219,6 +219,10 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild): ...@@ -219,6 +219,10 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
score_list[]: A multivalue key containing all the individual scores score_list[]: A multivalue key containing all the individual scores
""" """
closed, msg = self.check_if_closed()
if closed:
return msg
if self.child_state != self.ASSESSING: if self.child_state != self.ASSESSING:
return self.out_of_sync_error(data) return self.out_of_sync_error(data)
......
from datetime import datetime
import json import json
import unittest import unittest
from mock import Mock, MagicMock from mock import Mock, MagicMock
from webob.multidict import MultiDict from webob.multidict import MultiDict
from pytz import UTC
from xmodule.open_ended_grading_classes.self_assessment_module import SelfAssessmentModule from xmodule.open_ended_grading_classes.self_assessment_module import SelfAssessmentModule
from xmodule.modulestore import Location from xmodule.modulestore import Location
from lxml import etree from lxml import etree
...@@ -113,10 +114,13 @@ class SelfAssessmentTest(unittest.TestCase): ...@@ -113,10 +114,13 @@ class SelfAssessmentTest(unittest.TestCase):
""" """
# Create a module with no state yet. Important that this start off as a blank slate. # Create a module with no state yet. Important that this start off as a blank slate.
test_module = SelfAssessmentModule(get_test_system(), self.location, test_module = SelfAssessmentModule(
get_test_system(),
self.location,
self.definition, self.definition,
self.descriptor, self.descriptor,
self.static_data) self.static_data
)
saved_response = "Saved response." saved_response = "Saved response."
submitted_response = "Submitted response." submitted_response = "Submitted response."
...@@ -127,7 +131,7 @@ class SelfAssessmentTest(unittest.TestCase): ...@@ -127,7 +131,7 @@ class SelfAssessmentTest(unittest.TestCase):
self.assertEqual(test_module.get_display_answer(), "") self.assertEqual(test_module.get_display_answer(), "")
# Now, store an answer in the module. # Now, store an answer in the module.
test_module.handle_ajax("store_answer", {'student_answer' : saved_response}, get_test_system()) test_module.handle_ajax("store_answer", {'student_answer': saved_response}, get_test_system())
# The stored answer should now equal our response. # The stored answer should now equal our response.
self.assertEqual(test_module.stored_answer, saved_response) self.assertEqual(test_module.stored_answer, saved_response)
self.assertEqual(test_module.get_display_answer(), saved_response) self.assertEqual(test_module.get_display_answer(), saved_response)
...@@ -150,4 +154,19 @@ class SelfAssessmentTest(unittest.TestCase): ...@@ -150,4 +154,19 @@ class SelfAssessmentTest(unittest.TestCase):
# Confirm that the right response is loaded. # Confirm that the right response is loaded.
self.assertEqual(test_module.get_display_answer(), submitted_response) self.assertEqual(test_module.get_display_answer(), submitted_response)
def test_save_assessment_after_closing(self):
"""
Test storing assessment when close date is passed.
"""
responses = {'assessment': '0', 'score_list[]': ['0', '0']}
self.module.save_answer({'student_answer': "I am an answer"}, self.module.system)
self.assertEqual(self.module.child_state, self.module.ASSESSING)
#Set close date to current datetime.
self.module.close_date = datetime.now(UTC)
#Save assessment when close date is passed.
self.module.save_assessment(responses, self.module.system)
self.assertNotEqual(self.module.child_state, self.module.DONE)
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