mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-06 00:48:46 -04:00
Rename mixin to clarify purpose
`SortableMixin` no longer has anything to do with sorting, except that it inherits from the similarly-named `SortByNameMixin`. This commit: - renames it to describe its main purpose: doing equality (and identity) checks based on the `id` attribute - makes it no longer inherit from `SortByNameMixin`, so that the two can be used independently or combined
This commit is contained in:
@@ -14,7 +14,7 @@ from .populations import CITY_OF_LONDON
|
|||||||
from .repo import BroadcastAreasRepository, rtree_index
|
from .repo import BroadcastAreasRepository, rtree_index
|
||||||
|
|
||||||
|
|
||||||
class SortableMixin(SortByNameMixin):
|
class IdEqualityMixin:
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'{self.__class__.__name__}(<{self.id}>)'
|
return f'{self.__class__.__name__}(<{self.id}>)'
|
||||||
@@ -75,7 +75,7 @@ class BaseBroadcastArea(ABC):
|
|||||||
return max(500, min(estimated_bleed, 5000))
|
return max(500, min(estimated_bleed, 5000))
|
||||||
|
|
||||||
|
|
||||||
class BroadcastArea(BaseBroadcastArea, SortableMixin):
|
class BroadcastArea(BaseBroadcastArea, IdEqualityMixin, SortByNameMixin):
|
||||||
|
|
||||||
def __init__(self, row):
|
def __init__(self, row):
|
||||||
self.id, self.name, self._count_of_phones, self.library_id = row
|
self.id, self.name, self._count_of_phones, self.library_id = row
|
||||||
@@ -220,7 +220,7 @@ class CustomBroadcastAreas(SerialisedModelCollection):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BroadcastAreaLibrary(SerialisedModelCollection, SortableMixin, GetItemByIdMixin):
|
class BroadcastAreaLibrary(SerialisedModelCollection, SortByNameMixin, IdEqualityMixin, GetItemByIdMixin):
|
||||||
|
|
||||||
model = BroadcastArea
|
model = BroadcastArea
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user