From e3e7c99e117a2de822412366b214ca951050f581 Mon Sep 17 00:00:00 2001 From: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com> Date: Fri, 17 May 2024 18:51:47 +0530 Subject: [PATCH] chore: user favorite sequence (#4501) --- apiserver/plane/db/models/favorite.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apiserver/plane/db/models/favorite.py b/apiserver/plane/db/models/favorite.py index 95157c793..2ea1014bc 100644 --- a/apiserver/plane/db/models/favorite.py +++ b/apiserver/plane/db/models/favorite.py @@ -39,11 +39,11 @@ class UserFavorite(WorkspaceBaseModel): def save(self, *args, **kwargs): if self._state.adding: - largest_sort_order = UserFavorite.objects.filter( - workspace=self.workspace - ).aggregate(largest=models.Max("sort_order"))["largest"] - if largest_sort_order is not None: - self.sort_order = largest_sort_order + 10000 + largest_sequence = UserFavorite.objects.filter( + workspace=self.project.workspace + ).aggregate(largest=models.Max("sequence"))["largest"] + if largest_sequence is not None: + self.sequence = largest_sequence + 10000 super(UserFavorite, self).save(*args, **kwargs)