33 lines
829 B
Python
33 lines
829 B
Python
import logging
|
|
from typing import Self
|
|
|
|
from .metadata_list import BrickMetadataList
|
|
from .set_status import BrickSetStatus
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
# Lego sets status list
|
|
class BrickSetStatusList(BrickMetadataList[BrickSetStatus]):
|
|
kind: str = 'set statuses'
|
|
|
|
# Database table
|
|
table: str = 'bricktracker_set_statuses'
|
|
|
|
# Queries
|
|
select_query = 'set/metadata/status/list'
|
|
|
|
# Filter the list of set status
|
|
def filter(self, all: bool = False) -> list[BrickSetStatus]:
|
|
return [
|
|
record
|
|
for record
|
|
in self.records
|
|
if all or record.fields.displayed_on_grid
|
|
]
|
|
|
|
# Instantiate the list with the proper class
|
|
@classmethod
|
|
def new(cls, /, *, force: bool = False) -> Self:
|
|
return cls(BrickSetStatus, force=force)
|