Let administrators set the opening reserve size

The reserve was fixed at 5 by CHECK constraints on players and
recharge_settings. Migration 21 rebuilds both tables with foreign keys
off and checks them before committing; the reserve now goes from 1 to 50
and is set next to the recharge delay. A raised reserve restarts the
recharge of full players at once, a reduced one keeps their extra
openings, and the player counter shows the configured maximum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-21 17:02:01 +01:00
parent fd47514d81
commit d2ef3b098c
13 changed files with 216 additions and 35 deletions

View file

@ -1215,10 +1215,20 @@ test("administrator navigates sections, manages mythic content and previews visu
await expect(recharge.getByRole("combobox")).toHaveCount(0);
const applyRecharge = recharge.getByRole("button", { name: "Appliquer", exact: true });
await expect(applyRecharge).toBeDisabled();
// La réserve se règle à côté du délai ; le serveur de test est partagé : elle reste à 5 pour les autres scénarios.
const reserveInput = recharge.getByLabel("Réserve maximale");
await expect(reserveInput).toHaveValue("5");
await reserveInput.fill("51");
await expect(recharge.getByRole("status")).toHaveText("Réserve : entre 1 et 50 ouvertures.");
await expect(applyRecharge).toBeDisabled();
await reserveInput.fill("8");
await expect(recharge.getByRole("status")).toHaveText("1 h · 24 ouvertures par jour · réserve vide remplie en 8 h");
await expect(applyRecharge).toBeEnabled();
await reserveInput.fill("5");
await recharge.getByLabel("Délai en minutes").fill("30");
await expect(recharge.getByRole("status")).toHaveText("30 min · 48 ouvertures par jour · réserve vide remplie en 2 h 30 min");
await applyRecharge.click();
await page.getByRole("dialog", { name: "Passer à 1 ouverture toutes les 30 min ?" }).getByRole("button", { name: "Appliquer le délai" }).click();
await page.getByRole("dialog", { name: "Passer à 1 ouverture toutes les 30 min ?" }).getByRole("button", { name: "Appliquer la recharge" }).click();
await expect(recharge.locator(".nebula-admin-recharge-current")).toHaveText("1 ouverture toutes les 30 min · réserve de 5");
await expect(recharge.getByRole("button", { name: "Appliquer", exact: true })).toBeDisabled();