summaryrefslogtreecommitdiff
path: root/requirements/catalogue/req-088.md
diff options
context:
space:
mode:
Diffstat (limited to 'requirements/catalogue/req-088.md')
-rw-r--r--requirements/catalogue/req-088.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/requirements/catalogue/req-088.md b/requirements/catalogue/req-088.md
new file mode 100644
index 0000000..a1791fa
--- /dev/null
+++ b/requirements/catalogue/req-088.md
@@ -0,0 +1,36 @@
+# req-088
+
+As a user, when I'm creating, updating and deleting my buckets and pipes, I want
+to see the result of the procedure,
+`calculate_long_term_expected_monthly_tank_change`, described below,
+prominently, so that I see a prominent number which summarises the long-term
+difference between my planned incomings and outgoings.
+
+Source: req-085
+
+Satisfied by: ass-009, req-089, req-090, ass-021, dml-pipe
+
+## calculate_long_term_expected_monthly_tank_change
+
+Explanation: the least common multiple of a day, a week, a month and a year is
+28 years. This procedure works by summing what the tank draw of each pipe over
+28 years would be, and then dividing by 28 x 12 to get the long-term monthly
+tank draw.
+
+1. Let `factor` be `12 x 28`, that is, `336`.
+2. Let `tank_change_over_28_years` be the sum of
+ `calculate_tank_draw_for_pipe_over_28_years(pipe)` for each pipe, `pipe`.
+3. Return `tank_change_over_28_years / factor`.
+
+## calculate_tank_draw_for_pipe_over_28_years
+
+Inputs:
+
+- `pipe`: a pipe
+
+1. If `pipe.period` is `day`, let `factor` be `(365 x 3 + 366) x 7`, that is,
+ `10,227`.
+2. If `pipe.period` is `week`, let `factor` be `365 x 3 + 366`, that is, `1461`.
+3. If `pipe.period` is `month`, let `factor` be `12 x 28`, that is, `336`.
+4. If `pipe.period` is `year`, let `factor` be `28`.
+5. Return `pipe.amount x factor`.