Skip to content

Commit

Permalink
refactor: clear stale user interests #4504
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromsl committed Nov 28, 2024
1 parent 8cf7015 commit 91d558e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/core/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,14 @@ def save(self, commit=True):
user.clean()

posted_interests = self.cleaned_data['interests'].split(',')
user.interest.clear()
for interest in posted_interests:
if interest:
new_interest, _ = models.Interest.objects.get_or_create(
name=interest,
)
user.interest.add(new_interest)

for interest in user.interest.all():
if interest.name not in posted_interests:
user.interest.remove(interest)

user.save()

if commit:
Expand Down

0 comments on commit 91d558e

Please sign in to comment.