mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-28 19:06:19 -05:00
Fix file view tracking: docs mark viewed, previews count one view (#786)
Opening a doc on its page never set FileGroup.viewed, so docs were missing from Recently Viewed. GET /api/docs/:id now marks the doc viewed, with the same skip_viewed parameter as archives and videos. The file preview marked a file viewed more than once: opening from a ?preview= URL sent two tracked requests, and every tag change re-fetched the file with tracking on. The fetches now skip tracking, and the preview marks each opening viewed once. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a1292005ce
commit
531721c157
5 changed files with 114 additions and 5 deletions
|
|
@ -30,7 +30,8 @@ async def statistics(request: Request):
|
|||
@openapi.response(HTTPStatus.NOT_FOUND, JSONErrorResponse)
|
||||
async def get_doc(request: Request, file_group_id: int):
|
||||
session = request.ctx.session
|
||||
doc = _get_doc(session, file_group_id)
|
||||
skip_viewed = request.args.get('skip_viewed', '').lower() == 'true'
|
||||
doc = _get_doc(session, file_group_id, skip_viewed=skip_viewed)
|
||||
return json_response(_doc_response(doc))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue