Skip to content

Commit

Permalink
Update attribute descriptions on registrarimport, if changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mureytasroc committed Sep 11, 2023
1 parent f9c409b commit bfc0a71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/courses/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,15 @@ def add_attributes(course, attributes):
course.attributes.clear()
for attribute in attributes:
school = identify_school(attribute.get("attribute_code"))
desc = attribute.get("attribute_desc")
attr, _ = Attribute.objects.get_or_create(
code=attribute.get("attribute_code"),
defaults={"description": attribute.get("attribute_desc"), "school": school},
defaults={"description": desc, "school": school},
)
if attr.description != desc or attr.school != school:
attr.description = desc
attr.school = school
attr.save()
attr.courses.add(course)


Expand Down

0 comments on commit bfc0a71

Please sign in to comment.