Added stats
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from fastapi import Request
|
||||
from fastapi import HTTPException, Request
|
||||
from folkugat_web.model import temes as model
|
||||
from folkugat_web.model.pagines import Pages
|
||||
from folkugat_web.services import sessions as sessions_service
|
||||
from folkugat_web.services.temes import query as temes_q
|
||||
from folkugat_web.services.temes import search as temes_s
|
||||
from folkugat_web.templates import templates
|
||||
@@ -34,6 +35,8 @@ def temes_busca(request: Request, logged_in: bool, query: str, offset: int = 0,
|
||||
if offset > 0:
|
||||
prev_offset = max(offset - limit, 0)
|
||||
|
||||
temes = temes_q.temes_compute_stats(temes)
|
||||
|
||||
return templates.TemplateResponse(
|
||||
"fragments/temes/results.html",
|
||||
{
|
||||
@@ -51,6 +54,9 @@ def temes_busca(request: Request, logged_in: bool, query: str, offset: int = 0,
|
||||
|
||||
def tema(request: Request, tema_id: int, logged_in: bool):
|
||||
tema = temes_q.get_tema_by_id(tema_id)
|
||||
if not tema:
|
||||
raise HTTPException(status_code=404, detail="Could not find tune")
|
||||
tema = temes_q.tema_compute_stats(tema)
|
||||
return templates.TemplateResponse(
|
||||
"fragments/tema/pagina.html",
|
||||
{
|
||||
@@ -60,5 +66,6 @@ def tema(request: Request, tema_id: int, logged_in: bool):
|
||||
"LinkType": model.LinkType,
|
||||
"ContentType": model.ContentType,
|
||||
"tema": tema,
|
||||
"date_names": sessions_service.get_date_names,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user