bingo: lastmod from the last edit, not the last insert

The "updated" date and the sitemap lastmod came from max(created_at),
so editing a datacenter, fixing an incident title or deleting an
incident left them stale. Google stops trusting lastmod once it is
seen to be wrong.

Migration 014 adds updated_at (backfilled from created_at). Saves set
it, renumbering bumps only the rows whose position actually moved, and
deleting an incident bumps its datacenter. The admin delete now goes
through the model so the hook runs. The sitemap gives lastmod as a
full timestamp and drops changefreq, which Google ignores.

Assisted-by: Claude:opus-5
This commit is contained in:
Sergei Poljanski 2026-10-10 09:30:37 +04:00
commit 6f37e537ca
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
5 changed files with 54 additions and 7 deletions

View file

@ -221,7 +221,7 @@ module BingoAdmin
app.post '/admin/bingo/incidents/:id/delete' do
inc = Bingo::Incident[params[:id].to_i]
Bingo::Incident.where(id: params[:id].to_i).delete
inc&.destroy # hook bumps the datacenter's updated_at
audit!('bingo.incident_delete', inc&.datacenter&.slug, inc && "#{inc.occurred_on} #{inc.title_ru}")
session[:bingo_flash] = 'Incident deleted.'
redirect '/admin/bingo'