BGG: Powered-by-Logo im Footer (Lizenzpflicht) + Erscheinungsjahr-Filter (Standard aktuelles Jahr+)
This commit is contained in:
@@ -94,6 +94,7 @@ class NeuheitenPlugin(BasePlugin):
|
||||
user: User = Depends(require_user),
|
||||
q: str = "",
|
||||
status: str = "",
|
||||
jahr: int | None = None,
|
||||
sort: str = STANDARD_SORTIERUNG[0],
|
||||
richtung: str = STANDARD_SORTIERUNG[1],
|
||||
meldung: str = "",
|
||||
@@ -118,6 +119,26 @@ class NeuheitenPlugin(BasePlugin):
|
||||
)
|
||||
if status.strip():
|
||||
abfrage = abfrage.where(Neuheit.status == status.strip())
|
||||
# Erscheinungsjahr-Filter: Standard „aktuelles Jahr und neuer“.
|
||||
jahr_standard = datetime.now(timezone.utc).year
|
||||
if jahr is None:
|
||||
jahr_filter = jahr_standard
|
||||
abfrage = abfrage.where(
|
||||
or_(
|
||||
Neuheit.erscheinungsjahr >= jahr_standard,
|
||||
Neuheit.erscheinungsjahr.is_(None), # ohne Jahr nicht wegfiltern
|
||||
)
|
||||
)
|
||||
else:
|
||||
jahr_filter = jahr
|
||||
abfrage = abfrage.where(Neuheit.erscheinungsjahr >= jahr)
|
||||
jahr_optionen = [
|
||||
j for j in db.scalars(
|
||||
select(Neuheit.erscheinungsjahr).distinct().order_by(
|
||||
Neuheit.erscheinungsjahr.desc()
|
||||
)
|
||||
) if j is not None
|
||||
]
|
||||
gesamt = db.scalar(select(func.count()).select_from(abfrage.subquery())) or 0
|
||||
eintraege = db.scalars(
|
||||
abfrage.order_by(spalte_sortiert, Neuheit.id.asc())
|
||||
@@ -138,6 +159,9 @@ class NeuheitenPlugin(BasePlugin):
|
||||
"eintraege": eintraege,
|
||||
"q": q,
|
||||
"status_filter": status,
|
||||
"jahr_filter": jahr_filter,
|
||||
"jahr_standard": jahr_standard,
|
||||
"jahr_optionen": jahr_optionen,
|
||||
"sort": sort if sort in SORTIERBAR else STANDARD_SORTIERUNG[0],
|
||||
"richtung": "ab" if abwaerts else "auf",
|
||||
"status_optionen": status_optionen,
|
||||
|
||||
Reference in New Issue
Block a user