Skip to content

Commit

Permalink
fix: removed redundant unit update from task (openedx#33017)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhtishamShahid authored Aug 16, 2023
1 parent 852246d commit 62718f2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions openedx/core/djangoapps/discussions/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,9 @@ def get_discussable_units(course, enable_graded_units, discussable_units=None):
for unit in get_units(subsection):
idx += 1
if not is_discussable_unit(unit, store, enable_graded_units, subsection):
# TODO: if and log statement will be removed after testing.
if str(course.id) == "course-v1:NedX+CMH43+2023_Summer":
log.info(f"Checking discussions_enabled for {course.id}")
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)
if unit.discussion_enabled:
log.info(f"Unit {unit.location} of course {course.id} has discussion enabled "
f"but is not discussable")
continue
# 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
Expand Down

0 comments on commit 62718f2

Please sign in to comment.