Skip to main content
Four switches on a unit limit it over time: resets, supply, expires_after_days and expires_at.

Resets

A unit with resets on can be set back to 0 by a rule, whichever way the unit goes: a season’s XP, a month’s visit count. Pair it with a schedule.
It writes one receipt for each person it changed, with the balance after (0). A person already at 0 gets none. A streak’s own reset is on Rules.

A limited supply

switches.supply is the most that can ever be given in all, across everyone: “40 in all”.
  • It counts what is given from when the supply is set. stats.issued says how much.
  • When it has run out, a rule that would give it is skipped with the reason supply_gone, and a give by hand that is more than is left is refused whole.
  • Taking it back (an undo) does not give the supply back: it was given.
  • A supply cannot be set below what has already been given.

Expiry

switches.expires_after_days takes back what was given after that many days.
  • It applies to what is given from now on. What was there before keeps its place and never expires.
  • Spending uses what expires first, so what is spent does not expire.
  • Each hour the worker takes back what has expired, one receipt per person (via: "system", by system:expiry), so balances and receipts always agree.
  • An undo of a take gives the balance back without an expiry.
  • Turning it off forgets the clock: what is already given stays.

An end date

switches.expires_at ends the whole unit at a moment: a ticket for an event on a date. Nothing is given after it, and what is held then expires and is taken back, whatever expires_after_days says. It must be in the future when you set it; null removes it.