[insight] Goals and rewards: a goal this month (its tank, what is needed, the pace, the split between its ways, where money could come from), medals and challenges from complete periods, the cancel letter in Czech
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
# 05: Savings goals, ways to save, challenges and medals (v0.6.0)
|
||||
|
||||
This works like the rest of the core: `today` is a parameter, money is in haléře, and every level is in whole
|
||||
thousandths. **Fiscus never moves money.** A goal holds only what you said you put aside, so it is full only
|
||||
when you filled it. Goals and challenges are in your personal log. They are never shared: the sharing boundary
|
||||
(`share.rs`) builds only `payment.shared`.
|
||||
|
||||
## Goals (`fiscus-ledger::goal`)
|
||||
|
||||
| Event | What |
|
||||
|:--|:--|
|
||||
| `goal.created { goal, name, target, by?, colour }` | a goal |
|
||||
| `goal.changed { goal, name, target, by?, colour }` | its new name, target, date or colour; the latest counts |
|
||||
| `goal.ways_set { goal, ways }` | how it is saved for; replaces its earlier ways |
|
||||
| `goal.saved { goal, saving, amount, on, way? }` | put aside (positive) or taken out (negative), by one of its ways or by hand |
|
||||
| `goal.closed { goal, on }` | reached or given up; no more saving into it, the history stays |
|
||||
|
||||
**What a goal accepts:**
|
||||
- a name of 1–60 characters, with no spaces around it and no control characters;
|
||||
- a target of 1 Kč to 100 000 000 Kč;
|
||||
- at most 20 open goals;
|
||||
- a saving id used once, with an amount that is not zero, and never more taken out than the goal holds;
|
||||
- savings only into an open goal;
|
||||
- a saving made by a way only if the goal is saved for that way.
|
||||
|
||||
**Ways.** A goal has at most one way of each kind:
|
||||
|
||||
| Way | This month it comes to |
|
||||
|:--|:--|
|
||||
| `fixed { amount }` | the amount (1 Kč–100 000 000 Kč) |
|
||||
| `round_up { to }` | each spending payment of the month rounded up to the next `to` (10, 50 or 100 Kč); a payment already a multiple adds nothing |
|
||||
| `leftover { permille }` | that share of what last month's category plans did not use (per planned category, the plan less what was spent, never below 0) |
|
||||
| `income { permille }` | that share of last month's money in (not transfers) |
|
||||
|
||||
A share is 1–1000 thousandths. The open goals' shares of `leftover`, and separately of `income`, add up to at
|
||||
most 1000: together they can never take more than all of it. Closing a goal gives its shares back.
|
||||
|
||||
## A goal this month (`fiscus-insight::goals`)
|
||||
`goals_month(state, insight, today)` returns the open goals in the order they were made, then the closed ones,
|
||||
the latest closed first. Each goal has:
|
||||
- **saved**, **target**, **permille** (the tank's level, at most 1000) and **reached**;
|
||||
- **months_left** from this month to the month of `by`, both included, and **needed_per_month**: what is still
|
||||
needed, divided by those months and rounded up to whole crowns. Once the date has passed, all of what is
|
||||
still needed. Neither is set without a date, or once the goal is reached;
|
||||
- **pace**: put aside per month over the last three complete months, from the month of the first saving on;
|
||||
**reach_month**: the month it gets there at that pace;
|
||||
- **parts**, one per way. Each part has:
|
||||
- what the way comes to this month;
|
||||
- what was already put aside by it this month;
|
||||
- what is **left**. Together the parts never ask for more than the goal still needs: the parts take it in the
|
||||
goal's order of ways.
|
||||
|
||||
The month also has the leftover and the income that the shares are of, how much of each is given to goals, and
|
||||
**sources**, which point at money without changing anything:
|
||||
- **subscriptions** still charging that you have not decided to keep, with their cost a month (a yearly one
|
||||
divided by 12, rounded up). The 5 costliest;
|
||||
- **categories** that cost more last month than their average of the three months before, by at least 10 % and
|
||||
200 Kč. The 3 largest differences.
|
||||
|
||||
## Challenges
|
||||
|
||||
| Event | What |
|
||||
|:--|:--|
|
||||
| `challenge.started { challenge, goal, starts, ends }` | 1–92 days, both ends included; at most 20 running |
|
||||
| `challenge.abandoned { challenge, on }` | given up, once |
|
||||
|
||||
The `goal` of a challenge is one of these:
|
||||
- `spend_under { category, amount }`: a category you spend in (not income, transfers or uncategorised), 1 Kč or
|
||||
more;
|
||||
- `no_spend { category }`;
|
||||
- `cancel { subscription }`: decide to cancel it in the window, and not be charged for it after the decision;
|
||||
- `save { goal, amount }`: put this much aside for an open goal in the window.
|
||||
|
||||
## Rewards (`fiscus-insight::rewards`)
|
||||
`rewards(state, insight, shared_budgets, today)` computes the medals and the challenges from the ledger.
|
||||
Nothing is stored. A medal comes from a **complete** period only:
|
||||
|
||||
| Medal | Earned |
|
||||
|:--|:--|
|
||||
| `under_budget` | a budget under its (latest) limit 3+ complete months running; one medal per run. A shared budget earns none: only your own payments are counted, and its limit is everyone's |
|
||||
| `plans_kept` | a complete month with at least one plan, every plan kept |
|
||||
| `cancelled` | decided "cancel" and not charged since, past the day it would have charged |
|
||||
| `challenge_won` | `spend_under`, `no_spend` and `cancel` on their last day; `save` on the day it was reached |
|
||||
| `invoices_on_time` | a finished quarter in which every invoice due was paid by its due date |
|
||||
| `goal_milestone` | a goal at ¼, ½, ¾ and all of its target, on the day of the saving that got it there |
|
||||
| `saving_streak` | money put aside (more in than out across the goals) in 3+ complete months running |
|
||||
|
||||
The outcome of a challenge:
|
||||
- **Lost** as soon as it cannot be won: spending over the limit, any spending in a `no_spend` category, or a
|
||||
charge after the cancel decision;
|
||||
- **Abandoned** when given up, except a `save` challenge already reached, which stays won.
|
||||
|
||||
Its tank:
|
||||
- `spend_under`: what is left of the limit;
|
||||
- `no_spend`: full until anything is spent;
|
||||
- `cancel`: full once you decide to cancel and nothing has charged since;
|
||||
- `save`: what is saved of the amount.
|
||||
|
||||
**Progress** shows how far the medals not yet earned are:
|
||||
- months running with money put aside, and whether anything was put aside this month;
|
||||
- each budget's months running under its limit;
|
||||
- each open goal's level and its next milestone.
|
||||
|
||||
## The cancel kit in Czech
|
||||
`cancel_kit_in(subscription, language)` writes the email in Czech or English. `cancel_kit` stays English.
|
||||
Reference in New Issue
Block a user