8e4fa6448e
Closes #136. Spec #136 end to end: `finished` becomes a fact about the Series, written only by the owner, and the reader-facing Lifecycle bucket is gone. ## What landed - **#157** — `series.finished_at bigint NOT NULL DEFAULT 0` plus the migration whose statement order is load-bearing (seed from the buckets, then flip them); both Lane queries lose the `HAVING COUNT(*) FILTER (WHERE b.status <> 'finished')` clause and gate on `finished_at = 0` instead, with the due-query/eligible-count force asymmetry kept deliberate and commented; `StatusFinished`, its API special-case 400, the web tab and the templates' Finished bucket deleted. - **#158** — owner Finish control on the Series detail page: confirm-gated finish, instant un-finish, admin accent (never ember, nothing is destroyed), `Store.SetSeriesFinished`, the two routes behind the owner gate, and the state displayed on the list row without offering the control there. - **#160** — reader side: derived `finished` bool on the flat Bookmark (`s.finished_at > 0`), rendered as a text-only label in both userscripts and on the web card; read-only inbound by omission from `Upsert`'s explicit `series` column list, same mechanism that already protects `cover`. - **#161** — glossary and the stale Reader-count divergence note catch up. - **#159** — `finished` joins the admin filter vocabulary (predicate `finished_at > 0`, label `Finished`, own aggregate count, figure last in the stats block as informational); the four clock-driven hygiene predicates (stale, never-checked, no-cover, no-chapter) exclude finished Series while unpollable, orphan and sighting-raised deliberately do not. ## Verification `go vet ./...` and `go test ./...` green on the merged branch (Docker-backed, throwaway `postgres:17-alpine` per package). Each ticket also passed a two-axis review (spec + standards) on its own branch before merge. Reviewed-on: #163 Co-authored-by: Sulthan Zaki <sultankiki05@gmail.com> Co-committed-by: Sulthan Zaki <sultankiki05@gmail.com>
79 lines
4.0 KiB
HTML
79 lines
4.0 KiB
HTML
{{/* Per-Series page: one address per Series, keyed "<site>:<series_id>" so the
|
|
list row is one hop from it. Everything here is a Series-level fact plus
|
|
the anonymous Reader count. Check now lands in its own .dform below the
|
|
.detail-grid; the correction form is the grid's first column and the URL
|
|
repair the second (issue #151). The pending and corrected markers ride the
|
|
meta line with the other marks. */}}
|
|
{{define "series-detail"}}
|
|
<a class="ghost detail-back" href="/admin/series">← Series</a>
|
|
<h1 class="detail-title">{{.Title}}</h1>
|
|
<p class="detail-key">{{.Key}} · {{.Site}} · {{.Kind}}</p>
|
|
{{if .Cover}}<div class="cover"><img src="{{.Cover}}" alt="" loading="lazy"></div>
|
|
{{else}}<div class="cover"></div>{{end}}
|
|
{{template "series-detail-meta" .}}
|
|
<div class="detail-grid">
|
|
<form class="dform" hx-post="/admin/series/{{.Key}}/latest" hx-target="#detail-meta" hx-swap="outerHTML">
|
|
<h3>Correct latest chapter</h3>
|
|
<p class="hint">The next successful Poll overwrites this value.</p>
|
|
<div class="field">
|
|
<input type="number" name="chapter" step="any" placeholder="{{.Chapter}}" required>
|
|
<button type="submit" class="ghost">Set</button>
|
|
</div>
|
|
</form>
|
|
<form class="dform" hx-post="/admin/series/{{.Key}}/series-url" hx-target="#detail-meta" hx-swap="outerHTML">
|
|
<h3>Repair series URL</h3>
|
|
<p class="hint">The Poll fetches this address — storing is not verifying it. A Site-wide host change is a SQL migration, not two hundred forms.</p>
|
|
<div class="field">
|
|
<input type="url" name="series_url" value="{{.URL}}" required>
|
|
<button type="submit" class="ghost">Set</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{{if .CanPoll}}
|
|
<div class="dform">
|
|
<div class="field"><a class="ghost act" hx-post="/admin/series/{{.Key}}/poll" hx-target="#detail-meta" hx-swap="outerHTML" href="#">Check now</a></div>
|
|
</div>
|
|
{{end}}
|
|
{{if .CanRemove}}
|
|
<div class="dform">
|
|
<div class="field"><button class="ghost danger" hx-post="/admin/series/{{.Key}}/remove" hx-target="#detail-meta" hx-confirm="Removes this series and its stored cover. No Reader has it bookmarked; one re-bookmarking it recreates the row.">Remove</button></div>
|
|
</div>
|
|
{{end}}
|
|
{{if .Finished}}
|
|
<div class="dform">
|
|
<div class="field"><button type="button" class="ghost" hx-post="/admin/series/{{.Key}}/unfinish" hx-target="#detail-meta" hx-swap="outerHTML">Un-finish</button></div>
|
|
</div>
|
|
{{else}}
|
|
<div class="dform">
|
|
<div class="field"><button type="button" class="ghost" onclick="document.getElementById('confirm-finish').hidden = false">Finish</button></div>
|
|
<div class="confirm-row calm" id="confirm-finish" role="group" aria-live="polite" hidden>
|
|
<span>Mark this Series finished?</span>
|
|
<div>
|
|
<button type="button" class="go" hx-post="/admin/series/{{.Key}}/finish" hx-target="#detail-meta" hx-swap="outerHTML">Finish</button>
|
|
<button type="button" onclick="document.getElementById('confirm-finish').hidden = true">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{/* series-detail-meta is the meta line, and the answer a Check now or
|
|
correction press on the detail page swaps into its place: the same marks,
|
|
re-rendered after the stamp so the pending and corrected markers — and
|
|
the provenance line beside the number — describe the value they sit
|
|
next to. */}}
|
|
{{define "series-detail-meta"}}
|
|
<div class="detail-meta" id="detail-meta">
|
|
<span>ch {{.Chapter}}</span>
|
|
{{if .Provenance}}<span>{{.Provenance}}</span>{{end}}
|
|
<span>checked {{.Checked}}</span>
|
|
<span>{{.Readers}} readers</span>
|
|
{{if .Corrected}}<span class="mark">{{.Corrected}}</span>{{end}}
|
|
{{if .Pending}}<span class="mark">{{.Requested}}</span>{{end}}
|
|
{{if .FinishedSince}}<span class="mark">{{.FinishedSince}}</span>{{end}}
|
|
{{if .Unpollable}}<span class="mark">unpollable</span>{{end}}
|
|
{{if .NoCover}}<span class="mark">no cover</span>{{end}}
|
|
{{if .Orphan}}<span class="mark">orphan</span>{{end}}
|
|
{{if .SightingRaised}}<span class="mark">sighting-raised</span>{{end}}
|
|
</div>
|
|
{{end}} |