From 23d4a2b3db715395f6d8d28fe091d6225441ada3 Mon Sep 17 00:00:00 2001 From: Alexander Kryklia Date: Thu, 20 Jun 2013 15:09:05 +0300 Subject: [PATCH] renames is_completed to is_submitted, fixes docstrings and rst docs --- common/lib/xmodule/xmodule/capa_module.py | 19 +++++++++---------- .../lib/xmodule/xmodule/conditional_module.py | 6 ++++-- .../conditional_module/conditional_module.rst | 5 ++++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 792860e642..d9f7fc61aa 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -279,7 +279,7 @@ class CapaModule(CapaFields, XModule): """ Return True/False to indicate whether to show the "Check" button. """ - submitted_without_reset = (self.is_completed() and self.rerandomize == "always") + submitted_without_reset = (self.is_submitted() and self.rerandomize == "always") # If the problem is closed (past due / too many attempts) # then we do NOT show the "check" button @@ -302,7 +302,7 @@ class CapaModule(CapaFields, XModule): # then do NOT show the reset button. # If the problem hasn't been submitted yet, then do NOT show # the reset button. - if (self.closed() and not is_survey_question) or not self.is_completed(): + if (self.closed() and not is_survey_question) or not self.is_submitted(): return False else: return True @@ -322,7 +322,7 @@ class CapaModule(CapaFields, XModule): return not self.closed() else: is_survey_question = (self.max_attempts == 0) - needs_reset = self.is_completed() and self.rerandomize == "always" + needs_reset = self.is_submitted() and self.rerandomize == "always" # If the student has unlimited attempts, and their answers # are not randomized, then we do not need a save button @@ -516,19 +516,18 @@ class CapaModule(CapaFields, XModule): return False - def is_completed(self): - """ Used to decide to show or hide RESET or CHECK buttons. + def is_submitted(self): + """ + Used to decide to show or hide RESET or CHECK buttons. - Actually means that student submitted problem and nothing more. + Means that student submitted problem and nothing more. Problem can be completely wrong. Pressing RESET button makes this function to return False. - Suggestion: rename it to is_submitted. - - # older comment: return self.answer_available()""" + """ return self.lcp.done def is_attempted(self): - # used by conditional module + """Used by conditional module""" return self.attempts > 0 def is_correct(self): diff --git a/common/lib/xmodule/xmodule/conditional_module.py b/common/lib/xmodule/xmodule/conditional_module.py index a214dd290a..6dc86880ae 100644 --- a/common/lib/xmodule/xmodule/conditional_module.py +++ b/common/lib/xmodule/xmodule/conditional_module.py @@ -35,7 +35,9 @@ class ConditionalModule(ConditionalFields, XModule): tag attributes: sources - location id of required modules, separated by ';' - completed - map to `is_completed` module method + submitted - map to `is_submitted` module method. + (pressing RESET button makes this function to return False.) + attempted - map to `is_attempted` module method correct - map to `is_correct` module method poll_answer - map to `poll_answer` module attribute @@ -75,7 +77,7 @@ class ConditionalModule(ConditionalFields, XModule): # problem was submitted (it can be wrong) # if student will press reset button after that, # state will be reverted - 'completed': 'is_completed', # capa_problem attr + 'submitted': 'is_submitted', # capa_problem attr # if student attempted problem 'attempted': 'is_attempted', # capa_problem attr diff --git a/doc/public/course_data_formats/conditional_module/conditional_module.rst b/doc/public/course_data_formats/conditional_module/conditional_module.rst index 8f7ba17ffc..c0c3a3c338 100644 --- a/doc/public/course_data_formats/conditional_module/conditional_module.rst +++ b/doc/public/course_data_formats/conditional_module/conditional_module.rst @@ -23,8 +23,11 @@ be specified for this tag:: sources - location id of required modules, separated by ';' [message | ""] - message for case, where one or more are not passed. Here you can use variable {link}, which generate link to required module. + + [submitted] - map to `is_submitted` module method. + (pressing RESET button makes this function to return False.) - [completed] - map to `is_completed` module method + [correct] - map to `is_correct` module method [attempted] - map to `is_attempted` module method [poll_answer] - map to `poll_answer` module attribute [voted] - map to `voted` module attribute