From 8587044ea445bc6588b8b91aea6eaf1f90fb48ed Mon Sep 17 00:00:00 2001 From: ichuang Date: Mon, 18 Feb 2013 10:48:45 -0500 Subject: [PATCH 1/2] fix capa save button msgs, add simple capa survey mode --- common/lib/xmodule/xmodule/capa_module.py | 21 +++++++++++++------ .../xmodule/js/src/capa/display.coffee | 5 ++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 4635cc6871..ee4631f8ed 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -333,6 +333,12 @@ class CapaModule(XModule): reset_button = False save_button = False + # If attempts=0 then show just check and reset buttons; this is for survey questions using capa + if self.max_attempts==0: + check_button = False + reset_button = True + save_button = True + # User submitted a problem, and hasn't reset. We don't want # more submissions. if self.lcp.done and self.rerandomize == "always": @@ -622,11 +628,11 @@ class CapaModule(XModule): event_info['answers'] = answers # Too late. Cannot submit - if self.closed(): + if self.closed() and not self.max_attempts==0: event_info['failure'] = 'closed' self.system.track_function('save_problem_fail', event_info) return {'success': False, - 'error': "Problem is closed"} + 'msg': "Problem is closed"} # Problem submitted. Student should reset before saving # again. @@ -634,13 +640,16 @@ class CapaModule(XModule): event_info['failure'] = 'done' self.system.track_function('save_problem_fail', event_info) return {'success': False, - 'error': "Problem needs to be reset prior to save."} + 'msg': "Problem needs to be reset prior to save."} self.lcp.student_answers = answers - # TODO: should this be save_problem_fail? Looks like success to me... - self.system.track_function('save_problem_fail', event_info) - return {'success': True} + self.system.track_function('save_problem_success', event_info) + msg = "Your answers have been saved" + if not self.max_attempts==0: + msg += " but not graded. Hit 'Check' to grade them." + return {'success': True, + 'msg': msg} def reset_problem(self, get): ''' Changes problem state to unfinished -- removes student answers, diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index 57ff85298c..41c9b50891 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -262,9 +262,8 @@ class @Problem save: => Logger.log 'problem_save', @answers $.postWithPrefix "#{@url}/problem_save", @answers, (response) => - if response.success - saveMessage = "Your answers have been saved but not graded. Hit 'Check' to grade them." - @gentle_alert saveMessage + saveMessage = response.msg + @gentle_alert saveMessage @updateProgress response refreshMath: (event, element) => From fb705254179dc113ab6adaf71ab2227b7d54f635 Mon Sep 17 00:00:00 2001 From: ichuang Date: Tue, 19 Feb 2013 19:50:36 -0500 Subject: [PATCH 2/2] dummy change to re-trigger jenkins --- common/lib/xmodule/xmodule/capa_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index ee4631f8ed..27dddc2ebf 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -640,7 +640,7 @@ class CapaModule(XModule): event_info['failure'] = 'done' self.system.track_function('save_problem_fail', event_info) return {'success': False, - 'msg': "Problem needs to be reset prior to save."} + 'msg': "Problem needs to be reset prior to save"} self.lcp.student_answers = answers