Problem
Plot count still displays incorrectly (+1) despite the reconcile fix in PR #741. The Straton storyline shows "4 plots" but the actual count may be 3.
Investigation needed
- Query the
plots table for the Straton storyline — count actual distinct plot_index values
- Check if genesis plot was inserted twice (duplicate row in
plots table)
- If duplicate exists, delete it and re-run reconcile
- If no duplicate, check if
plot_count field just wasn't re-reconciled after deployment
Likely cause
Either:
- A duplicate genesis plot entry exists in the
plots table (reconcile counts rows, so COUNT(*) would include the duplicate)
- The reconcile endpoint
/api/cron/reconcile-plots was never triggered after deployment
Fix
- Run a Supabase query:
SELECT plot_index, COUNT(*) FROM plots WHERE storyline_id = '<id>' GROUP BY plot_index
- If duplicates found: deduplicate and reconcile
- If no duplicates: just re-run the reconcile endpoint for all storylines
- Add a unique constraint on
(storyline_id, plot_index) to prevent future duplicates
Branch
task/763-plot-count-fix
Problem
Plot count still displays incorrectly (+1) despite the reconcile fix in PR #741. The Straton storyline shows "4 plots" but the actual count may be 3.
Investigation needed
plotstable for the Straton storyline — count actual distinctplot_indexvaluesplotstable)plot_countfield just wasn't re-reconciled after deploymentLikely cause
Either:
plotstable (reconcile counts rows, so COUNT(*) would include the duplicate)/api/cron/reconcile-plotswas never triggered after deploymentFix
SELECT plot_index, COUNT(*) FROM plots WHERE storyline_id = '<id>' GROUP BY plot_index(storyline_id, plot_index)to prevent future duplicatesBranch
task/763-plot-count-fix