Make process to add open ended tab to studio reversible

This commit is contained in:
Vik Paruchuri
2013-03-29 15:53:28 -04:00
parent b8e6c94dd6
commit 033f5ce73c
2 changed files with 33 additions and 4 deletions

View File

@@ -210,3 +210,19 @@ def add_open_ended_panel_tab(course):
course_tabs.append(OPEN_ENDED_PANEL)
changed = True
return changed, course_tabs
def remove_open_ended_panel_tab(course):
"""
Used to remove the open ended panel tab from a course if it exists.
@param course: A course object from the modulestore.
@return: Boolean indicating whether or not a tab was added and a list of tabs for the course.
"""
#Copy course tabs
course_tabs = copy.copy(course.tabs)
changed = False
#Check to see if open ended panel is defined in the course
if OPEN_ENDED_PANEL in course_tabs:
#Add panel to the tabs if it is not defined
course_tabs = [ct for ct in course_tabs if ct!=OPEN_ENDED_PANEL]
changed = True
return changed, course_tabs