Built: units/research/training, movements (scan, raid, attack, takeover, reinforce, settle, transport), deterministic combat resolved in the event queue, reports, power/offline units, founding + conquest + incumbent sites; alliances, roles, diplomacy (24h pact cancel via events), messages, rankings; vanilla-JS phone-first client (auth, POP, map, alerts, settings, en/nb); systemd units, backup timer, DEPLOY.md, tools/admin.js. Tested: npm test 96/96 (fake clock, in-memory db, a few real-HTTP tests); client checked with headless Chromium screenshots only. NOT done: marketplace/transport trade, client screens for military/social, WebSocket push, bots/balance, e2e suite. All unit stats and costs are unbalanced first guesses. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
9 lines
664 B
JavaScript
9 lines
664 B
JavaScript
'use strict';
|
|
/* Delete expired reports (14 days, real time), then arm the next cleanup for the earliest remaining expiry. createReport
|
|
* arms it when none is pending, so there is at most one pending cleanup per world and none while no reports exist. */
|
|
module.exports = function reportCleanup(ctx, ev) {
|
|
const { db } = ctx;
|
|
db.run('DELETE FROM reports WHERE world_id = ? AND expires_at <= ?', ev.worldId, ev.dueAt);
|
|
const left = db.get('SELECT MIN(expires_at) AS e FROM reports WHERE world_id = ?', ev.worldId);
|
|
if (left && left.e !== null) ctx.enqueue({ worldId: ev.worldId, dueAt: left.e, type: 'reportCleanup', payload: { worldId: ev.worldId } });
|
|
};
|