fix: removed redundant unit update from task (#33017)
This commit is contained in:
@@ -110,16 +110,9 @@ def get_discussable_units(course, enable_graded_units, discussable_units=None):
|
|||||||
for unit in get_units(subsection):
|
for unit in get_units(subsection):
|
||||||
idx += 1
|
idx += 1
|
||||||
if not is_discussable_unit(unit, store, enable_graded_units, subsection):
|
if not is_discussable_unit(unit, store, enable_graded_units, subsection):
|
||||||
# TODO: if and log statement will be removed after testing.
|
if unit.discussion_enabled:
|
||||||
if str(course.id) == "course-v1:NedX+CMH43+2023_Summer":
|
log.info(f"Unit {unit.location} of course {course.id} has discussion enabled "
|
||||||
log.info(f"Checking discussions_enabled for {course.id}")
|
f"but is not discussable")
|
||||||
if unit.discussion_enabled:
|
|
||||||
unit.discussion_enabled = False
|
|
||||||
store.update_item(unit, unit.published_by, isPublish=True, emit_signals=False)
|
|
||||||
log.info(f"Updating discussions_enabled for {course.id}")
|
|
||||||
else:
|
|
||||||
unit.discussion_enabled = False
|
|
||||||
store.update_item(unit, unit.published_by, emit_signals=False)
|
|
||||||
continue
|
continue
|
||||||
# check if discussable_units is type of list and discussable_units is empty
|
# check if discussable_units is type of list and discussable_units is empty
|
||||||
# it means if discussable_units is empty then we should not create any topic
|
# it means if discussable_units is empty then we should not create any topic
|
||||||
|
|||||||
Reference in New Issue
Block a user