summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2025-07-24 12:46:32 +0100
committerJoe Carstairs <jcarstairs@scottlogic.com>2025-07-24 12:46:32 +0100
commit56f8a44a7035a286f73021c3543a72d975025fa0 (patch)
tree63c017d8354f94bbcd66d1b4da268dcb7db361c0
parenta9b90c7f6079c32f3b0245b79dbc0329cc142ff6 (diff)
task-059: adds req-113
-rw-r--r--requirements/catalogue/req-037.md18
-rw-r--r--requirements/catalogue/req-096.md2
-rw-r--r--requirements/catalogue/req-113.md9
-rw-r--r--requirements/catalogue/req-114.md9
-rw-r--r--requirements/catalogue/req-115.md5
-rw-r--r--requirements/catalogue/req-116.md14
-rw-r--r--requirements/catalogue/req-117.md19
-rw-r--r--requirements/data_models/dml-pipe.md15
8 files changed, 70 insertions, 21 deletions
diff --git a/requirements/catalogue/req-037.md b/requirements/catalogue/req-037.md
index 8a3433d..305f09e 100644
--- a/requirements/catalogue/req-037.md
+++ b/requirements/catalogue/req-037.md
@@ -5,7 +5,7 @@ Schist must implement the procedure, described below as
Sources: req-030, req-097
-Satisfied by: task-001, task-006, task-054
+Satisfied by: task-001, task-006, task-054, req-117
## update_budget_drips_for_bucket
@@ -13,19 +13,11 @@ Inputs:
- A bucket, `bucket`
-1. For each pipe `p` such that `p.bucket_id = bucket.id`, carry out the
- sub-procedure, `update_budget_drips_for_pipe(pipe)`, as described below.
-
-## update_budget_drips_for_pipe
-
-Inputs:
-
-- A pipe, `pipe`
-
1. Let `prev_drip` be a drip `d` with a most recent value for the property
- `date` such that `d.pipe_id = pipe.id`
-2. For each calendar date `d` in the range `(prev_drip.date, today]`, insert a
- new drip for `pipe`:
+ `date` such that `d.bucket_id = bucket.id`
+2. For each calendar date `d` in the range `(prev_drip.date, today]`, let
+ `pipe` be the result of `get_current_pipe_for_bucket_on_date(bucket, d)` as
+ described in req-117, and insert a new drip with these properties:
- `bucket_id`: `pipe.bucket_id`
- `pipe_id`: `pipe.id`
- `date`: `d`
diff --git a/requirements/catalogue/req-096.md b/requirements/catalogue/req-096.md
index f417a31..bec8f76 100644
--- a/requirements/catalogue/req-096.md
+++ b/requirements/catalogue/req-096.md
@@ -5,4 +5,4 @@ of a given bucket alongside the history of pipes of the given bucket.
Source: req-100
-Satisfied by: task-061, task-062
+Satisfied by: task-061, task-062, req-113, req-115
diff --git a/requirements/catalogue/req-113.md b/requirements/catalogue/req-113.md
new file mode 100644
index 0000000..87ec36b
--- /dev/null
+++ b/requirements/catalogue/req-113.md
@@ -0,0 +1,9 @@
+# req-113
+
+Pipes must be associated with a range of dates, which represent the range of
+dates on which the pipe should cause drips of its specified amount into its
+specified bucket.
+
+Source: req-096
+
+Satisfied by: req-114, req-037
diff --git a/requirements/catalogue/req-114.md b/requirements/catalogue/req-114.md
new file mode 100644
index 0000000..3fa3277
--- /dev/null
+++ b/requirements/catalogue/req-114.md
@@ -0,0 +1,9 @@
+# req-114
+
+Pipes must have a `start_date` property, which represents the first date on
+which the pipe should cause, or should have caused, drips into its associated
+bucket.
+
+Source: req-113
+
+Satisfied by: dml-pipe, req-116
diff --git a/requirements/catalogue/req-115.md b/requirements/catalogue/req-115.md
new file mode 100644
index 0000000..9c6a06e
--- /dev/null
+++ b/requirements/catalogue/req-115.md
@@ -0,0 +1,5 @@
+# req-115
+
+Pipes must never be deleted nor updated.
+
+Source: req-096
diff --git a/requirements/catalogue/req-116.md b/requirements/catalogue/req-116.md
new file mode 100644
index 0000000..e8ac090
--- /dev/null
+++ b/requirements/catalogue/req-116.md
@@ -0,0 +1,14 @@
+# req-116
+
+Pipes must have the following properties:
+
+- `amount`
+- `period`
+- `bucket_id`
+
+which together represent a flow of `amount` of money each `period` into the
+bucket with the `id` equal to `bucket_id`.
+
+Source: req-113, req-114
+
+Satisfied by: dml-pipe, req-111
diff --git a/requirements/catalogue/req-117.md b/requirements/catalogue/req-117.md
new file mode 100644
index 0000000..dccfa41
--- /dev/null
+++ b/requirements/catalogue/req-117.md
@@ -0,0 +1,19 @@
+# req-117
+
+Schist must implement the procedure, `get_current_pipes_for_bucket_on_date`,
+as described below.
+
+## get_current_pipe_for_bucket_on_date
+
+Inputs:
+
+- `bucket`: a bucket
+- `date`: a date
+
+1. Let `most_recent_pipes` be the list of pipes `pipe` with the most recent
+ `pipe.start_date` such that `pipe.bucket_id` equals `bucket.id` and
+ `pipe.start_date` is no later than `date`.
+2. Return a pipe `pipe` in `most_recent_pipes` with the most recent
+ `pipe.timestamp`.
+
+Sources: req-037 \ No newline at end of file
diff --git a/requirements/data_models/dml-pipe.md b/requirements/data_models/dml-pipe.md
index 7a6825d..a78f710 100644
--- a/requirements/data_models/dml-pipe.md
+++ b/requirements/data_models/dml-pipe.md
@@ -3,12 +3,13 @@
A pipe represents how much money the user wants to come in or go out of a
bucket. In other words, it represents a flow of money from the tank to a bucket.
-| Field | Type | Description |
-| --------- | ------ | -------------------------------------------------------- |
-| id | string | |
-| amount | number | The amount of money flowing through the pipe. |
-| period | string | How long it takes for `amount` to flow through the pipe. |
-| bucket_id | string | The ID of the bucket to which this pipe corresponds. |
+| Field | Type | Description |
+| ---------- | ------ | -------------------------------------------------------- |
+| id | string | |
+| amount | number | The amount of money flowing through the pipe. |
+| period | string | How long it takes for `amount` to flow through the pipe. |
+| bucket_id | string | The ID of the bucket to which this pipe corresponds. |
+| start_date | date | The first date on which money flowed through the pipe. |
Constraints:
@@ -18,4 +19,4 @@ Constraints:
- `month`
- `year`
-Sources: req-017, req-037, req-088
+Sources: req-017, req-037, req-088, req-114, req-116