Files
Showy/docs-vault/Watch Tracking.md
T
Mohammed Abad ce01dc34fa feat(backend): fix credit duplicates, support multi-role TV credits, fix collection upload
- Fix credit dedup key to people_id + cast_type (scoped to entry_id)
- Detect aggregate_credits format via Array.isArray(c.roles) instead of is_tvseries flag
- Join multiple roles/jobs with "; " instead of taking only the first
- Add episode_count field to Credit model from total_episode_count
- Increase character and job columns to VARCHAR(500)
- Deselect existing collection posters/backdrops before inserting new upload
- Updated docs-vault
- Updated some agents files
2026-04-23 16:51:18 +01:00

81 lines
2.6 KiB
Markdown

---
title: Watch Tracking
tags:
- feature
- watch-tracking
- seen
---
# Watch Tracking
## Overview
Showy tracks when users watch movies and episodes. Two models handle this:
| Model | For | Key Fields |
|---|---|---|
| [[Models#EntrySeen\|EntrySeen]] | Movies | `entry_id`, `date_seen`, `seen_with`, `accuracy` |
| [[Models#EpisodeSeen\|EpisodeSeen]] | Episodes | `entry_id`, `episode_id`, `date_seen`, `seen_with`, `accuracy` |
## Accuracy System
Every watch record has an `accuracy` field indicating how precise the `date_seen` is:
| Value | Meaning | Used in Statistics |
|---|---|---|
| `EXACT` | User knows the exact date | Yes — [[Statistics#CouchDayChart]] |
| `ESTIMATED` | Approximate date | No — excluded from day-of-week charts |
| `UNKNOWN` | No date information | No |
> [!tip] Why Accuracy Matters
> When importing historical watch data, exact dates are often unknown. The accuracy field prevents estimated dates from skewing [[Statistics]] charts that rely on day-of-week patterns.
## Frontend Dialogs
### EntrySeenDialog
- File: `components/dialogs/EntrySeenDialog.tsx`
- Used for: Movies (create/edit watch records) and TV episodes (mark season episodes as seen)
- Form: react-hook-form + zod validation
- Date input: Native `<input type="date">` (allows easy year selection)
- Date + accuracy displayed in same row
### EpisodeSeenEditDialog
- File: `components/dialogs/EpisodeSeenEditDialog.tsx`
- Used for: Creating/editing individual episode watch records
- Date + accuracy in same row
- Includes "seen with" field
## API Endpoints
See [[API Reference#Entry Seen (Movie Watch Records)]] and [[API Reference#Episode Seen (Episode Watch Records)]].
## Hooks
- [[Hooks#useEntrySeen]] — Movie watch record CRUD
- [[Hooks#useEpisodeSeen]] — Episode watch record CRUD
## Batch Operations
### Mark Season Watched
The [[Pages#SeasonPage|SeasonPage]] has a "Mark Season Watched" button (always visible) that opens the [[Components#Dialogs|MarkSeasonWatchedDialog]]. Two modes:
#### Single Date Mode
1. User picks a single date, accuracy, and optional "seen with"
2. All unwatched episodes are marked as seen on that date
#### Scatter Mode
1. User toggles scatter mode and picks a start date and end date
2. Episodes are distributed evenly across the date range
3. A preview shows total days and max episodes/day
4. Each episode gets a different `date_seen` based on the distribution
## Side Effects
When watch records are created/updated/deleted:
- `date_first_seen` and `date_last_seen` are updated on the Entry/Episode
- Statistics queries are affected (if accuracy = EXACT)