From b52aa39199524012e7da8b45cc9d7d4ca682e753 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 12:01:31 +0100 Subject: edit req-000 --- requirements/catalogue/req-000.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-000.md b/requirements/catalogue/req-000.md index 6f54440..913f592 100644 --- a/requirements/catalogue/req-000.md +++ b/requirements/catalogue/req-000.md @@ -1,6 +1,6 @@ # req-000 -As a user, I want my incomings to equal my outgoings in the long run, so that I -don't go bankrupt. +As a user, I want my outgoings not to exceed my incomings in the long run, so +that I don't go bankrupt. -Source: user need. +Source: need-000. -- cgit v1.2.3 From a76950de620ceb6c9866d3c13a4ac2a6af6a26b5 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 12:02:27 +0100 Subject: req-001 sourced from need-001 --- requirements/catalogue/req-001.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-001.md b/requirements/catalogue/req-001.md index 12bef30..3e3cefc 100644 --- a/requirements/catalogue/req-001.md +++ b/requirements/catalogue/req-001.md @@ -2,4 +2,4 @@ As a user, I want to control what I do with my money, so that I use money well. -Source: user need. +Source: need-001. -- cgit v1.2.3 From a1f4f2b216201f9e305dbde65f2d3035684fe423 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 12:05:17 +0100 Subject: add req-025 --- requirements/catalogue/req-025.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 requirements/catalogue/req-025.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-025.md b/requirements/catalogue/req-025.md new file mode 100644 index 0000000..b0cacd8 --- /dev/null +++ b/requirements/catalogue/req-025.md @@ -0,0 +1,6 @@ +# req-025 + +As a user, I want my incomings not to exceed my outgoings in the long run, so +that I can use my money well. + +Source: need-001 \ No newline at end of file -- cgit v1.2.3 From c1e92445b17f6042b0bb43e463345aae1d726c26 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 12:49:07 +0100 Subject: fix req-000 --- requirements/catalogue/req-000.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-000.md b/requirements/catalogue/req-000.md index 913f592..02ee740 100644 --- a/requirements/catalogue/req-000.md +++ b/requirements/catalogue/req-000.md @@ -3,4 +3,4 @@ As a user, I want my outgoings not to exceed my incomings in the long run, so that I don't go bankrupt. -Source: need-000. +Source: need-000 -- cgit v1.2.3 From 7a39eeac6050727b5aa5a8907649df9427aed5b2 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 12:49:35 +0100 Subject: fix req-001 --- requirements/catalogue/req-001.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-001.md b/requirements/catalogue/req-001.md index 3e3cefc..2161790 100644 --- a/requirements/catalogue/req-001.md +++ b/requirements/catalogue/req-001.md @@ -2,4 +2,4 @@ As a user, I want to control what I do with my money, so that I use money well. -Source: need-001. +Source: need-001 -- cgit v1.2.3 From b334f6ab986c6b9f81f8c1afac709822a349b481 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:00:44 +0100 Subject: add req-026 --- requirements/catalogue/req-026.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 requirements/catalogue/req-026.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-026.md b/requirements/catalogue/req-026.md new file mode 100644 index 0000000..f74cf18 --- /dev/null +++ b/requirements/catalogue/req-026.md @@ -0,0 +1,8 @@ +# req-026 + +Buckets must have a `name` property, which describes a real-world category of +spending. + +Source: req-017 + +Satisfied by: dml-bucket \ No newline at end of file -- cgit v1.2.3 From e4a45be445c7b85b5ab5a2f6addd08336d9e45ee Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:03:05 +0100 Subject: add req-027 --- requirements/catalogue/req-027.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 requirements/catalogue/req-027.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-027.md b/requirements/catalogue/req-027.md new file mode 100644 index 0000000..83208a7 --- /dev/null +++ b/requirements/catalogue/req-027.md @@ -0,0 +1,9 @@ +# req-027 + +Buckets must have a `balance` property, which represents the amount of money +currently in the bucket, that is, the difference between the amount of money +which has flowed in from a pipe less the amount taken out by my transactions. + +Source: req-017 + +Satisfied by: dml-bucket -- cgit v1.2.3 From 3ab0b1a764d9f2bd6745d03cc9bd520c325b115a Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:07:19 +0100 Subject: add req-028 --- requirements/catalogue/req-002.md | 2 +- requirements/catalogue/req-003.md | 2 +- requirements/catalogue/req-006.md | 2 +- requirements/catalogue/req-028.md | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 requirements/catalogue/req-028.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-002.md b/requirements/catalogue/req-002.md index 36bc9f8..3d87553 100644 --- a/requirements/catalogue/req-002.md +++ b/requirements/catalogue/req-002.md @@ -7,4 +7,4 @@ my money, so that I control what I do with my money. Source: req-001 -Satisfied by: req-003, req-006, req-017, ass-001, ass-002 +Satisfied by: req-028, req-017, ass-002 diff --git a/requirements/catalogue/req-003.md b/requirements/catalogue/req-003.md index dc746a8..6232329 100644 --- a/requirements/catalogue/req-003.md +++ b/requirements/catalogue/req-003.md @@ -5,6 +5,6 @@ spend on beer, so that having buckets and pipes which express how I want to distribute, and have previously distributed, my incomings and outgoings enables me to control my spending. -Source: req-002 +Source: req-028 Satisfied by: req-004 diff --git a/requirements/catalogue/req-006.md b/requirements/catalogue/req-006.md index 9b97791..be53d48 100644 --- a/requirements/catalogue/req-006.md +++ b/requirements/catalogue/req-006.md @@ -5,6 +5,6 @@ I spend on holidays, so that having buckets and pipes which express how I want to distribute, and have previously distributed, my incomings and outgoings enables me to control what I do with my money. -Source: req-002 +Source: req-028 Satisfied by: req-007 diff --git a/requirements/catalogue/req-028.md b/requirements/catalogue/req-028.md new file mode 100644 index 0000000..6832c9e --- /dev/null +++ b/requirements/catalogue/req-028.md @@ -0,0 +1,10 @@ +# req-028 + +As a user, I want how much money is in my buckets to influence how much I spend +on the real categories of spending which they represent, so that having buckets +and pipes which express how I want to distribute, and have previously +distributed, my incomings and outgoings enables me to control my spending. + +Source: req-002 + +Satisfied by: req-003, req-006, ass-001, req-026, req-027 -- cgit v1.2.3 From b449b7eaf90bf795bd0ecfbe8480b98f00af33e5 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:14:38 +0100 Subject: add req-029 --- requirements/catalogue/req-029.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 requirements/catalogue/req-029.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-029.md b/requirements/catalogue/req-029.md new file mode 100644 index 0000000..24eb7c1 --- /dev/null +++ b/requirements/catalogue/req-029.md @@ -0,0 +1,5 @@ +# req-029 + +Schist must have an SMS interface for reading the balance of a given bucket. + +Source: req-020 \ No newline at end of file -- cgit v1.2.3 From 60e292521fb7a6afbe44d41a0eebb11cfd544848 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:15:02 +0100 Subject: req-020 satisfied by req-024, req-029 --- requirements/catalogue/req-020.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-020.md b/requirements/catalogue/req-020.md index a745400..cbc5e5e 100644 --- a/requirements/catalogue/req-020.md +++ b/requirements/catalogue/req-020.md @@ -5,3 +5,5 @@ that I can know how much money is in my beer bucket when I'm at the bar and I have access to my phone. Source: req-018 + +Satisfied by: req-024, req-029 -- cgit v1.2.3 From bf2722034f0ae8ddc2277894542b8d6eb3b90527 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:48:04 +0100 Subject: add req-030 --- requirements/catalogue/req-030.md | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 requirements/catalogue/req-030.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-030.md b/requirements/catalogue/req-030.md new file mode 100644 index 0000000..38961be --- /dev/null +++ b/requirements/catalogue/req-030.md @@ -0,0 +1,47 @@ +# req-030 + +Schist must implement the procedure described below as `calculate_bucket_balance`. + +## calculate_bucket_balance + +Inputs: + +- A bucket name, `name` + +1. If no bucket exists with the name, `name`, then return empty. +2. If more than one bucket exists with the name, `name`, then panic. +3. Let `bucket` be the bucket with the given name. +4. Let `cache_key = bucket.balance_cache_key`. +5. Let `is_up_to_date` be the result of the sub-procedure, + `is_bucket_balance_up_to_date(bucket)`, as described below. +6. If `is_up_to_date = TRUE`, then return `bucket.balance`. +7. Let `transaction_sum` be the sum over the property, `amount`, of all + transactions `t` such that `t.bucket_id = bucket.id`. +8. Let `drip_sum` be the sum over the property, `amount`, of all drips `d` such + that `d.bucket_id = bucket.id`. +9. Return `drip_sum - transaction_sum`. + +## is_bucket_balance_up_to_date + +Inputs: + +- A bucket, `bucket` + +1. Let `cache_key = bucket.balance_cache_key`. +2. If `cache_key` is not in the format, `:`, then return FALSE. +3. Let `drip_id` be the part of `cache_key` before the `:`. +4. If there is no drip with the ID, `drip_id`, then return FALSE. +5. Let `drip` be the drip with the ID, `drip_id`. +6. If there is a drip, `drip_2`, such that `drip_2.date > drip.date` and + `drip.bucket_id = bucket.id`, then return FALSE. +7. Let `transaction_id` be the part of `cache_key` after the `:`. +8. If there is no transaction with the ID, `transaction_id`, then return FALSE. +9. Let `transaction` be the transaction with the ID, `transaction_id`. +10. If there is a transaction, `transaction_2`, such that + `transaction_2.date > transaction.date` and + `transaction.bucket_id = bucket.id`, then return FALSE. +11. Return TRUE. + +Source: req-029 + +Satisfied by: dml-bucket, dml-drip -- cgit v1.2.3 From 22d62da7584859b92f449aea8f92e48c21459b72 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:52:00 +0100 Subject: edit req-024 --- requirements/catalogue/req-024.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-024.md b/requirements/catalogue/req-024.md index 612132f..6b56acc 100644 --- a/requirements/catalogue/req-024.md +++ b/requirements/catalogue/req-024.md @@ -1,6 +1,6 @@ # req-023 -As a user, I want Schist to have an accurate record of the balance of my beer +As a user, I want Schist to be able to infer the accurate balance of my beer bucket, so that I can find out my beer balance in Schist using SMS. Source: req-020 -- cgit v1.2.3 From f27abfd486c92c50038336424fc89bf77334ee3c Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:54:58 +0100 Subject: add req-031 --- requirements/catalogue/req-031.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 requirements/catalogue/req-031.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-031.md b/requirements/catalogue/req-031.md new file mode 100644 index 0000000..11a2f29 --- /dev/null +++ b/requirements/catalogue/req-031.md @@ -0,0 +1,6 @@ +# req-031 + +Schist must have an SMS interface for the procedure, `calculate_bucket_balance` +as described in req-030. + +Source: req-029 \ No newline at end of file -- cgit v1.2.3 From 30286f8b03a017887f3bfcb4734896f144d44a92 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:56:05 +0100 Subject: add req-032 --- requirements/catalogue/req-024.md | 2 ++ requirements/catalogue/req-032.md | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 requirements/catalogue/req-032.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-024.md b/requirements/catalogue/req-024.md index 6b56acc..5119d3e 100644 --- a/requirements/catalogue/req-024.md +++ b/requirements/catalogue/req-024.md @@ -4,3 +4,5 @@ As a user, I want Schist to be able to infer the accurate balance of my beer bucket, so that I can find out my beer balance in Schist using SMS. Source: req-020 + +Satisfied by: req-032 diff --git a/requirements/catalogue/req-032.md b/requirements/catalogue/req-032.md new file mode 100644 index 0000000..aa08be1 --- /dev/null +++ b/requirements/catalogue/req-032.md @@ -0,0 +1,5 @@ +# req-032 + +Schist must be able to infer the accurate balance of any given bucket. + +Source: req-024 \ No newline at end of file -- cgit v1.2.3 From 3500683722c5290532ec77785fd4ad943450722c Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 13:58:41 +0100 Subject: add req-033 --- requirements/catalogue/req-033.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 requirements/catalogue/req-033.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-033.md b/requirements/catalogue/req-033.md new file mode 100644 index 0000000..9df39d2 --- /dev/null +++ b/requirements/catalogue/req-033.md @@ -0,0 +1,5 @@ +# req-033 + +Whenever the user makes a transaction, they must be able to enter it into Schist. + +Source: req-032 -- cgit v1.2.3 From 59d72b6c6a5f48a49fcbe91fee72eff20b9bb8d3 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 14:03:00 +0100 Subject: add req-034 --- requirements/catalogue/req-033.md | 2 +- requirements/catalogue/req-034.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 requirements/catalogue/req-034.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-033.md b/requirements/catalogue/req-033.md index 9df39d2..fce9092 100644 --- a/requirements/catalogue/req-033.md +++ b/requirements/catalogue/req-033.md @@ -2,4 +2,4 @@ Whenever the user makes a transaction, they must be able to enter it into Schist. -Source: req-032 +Source: req-034 diff --git a/requirements/catalogue/req-034.md b/requirements/catalogue/req-034.md new file mode 100644 index 0000000..d8e2137 --- /dev/null +++ b/requirements/catalogue/req-034.md @@ -0,0 +1,5 @@ +# req-034 + +Schist must have an accurate record of my transactions. + +Source: req-032 \ No newline at end of file -- cgit v1.2.3 From af7920c8e9405ea0e7591907555edad3a19688c8 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 14:06:41 +0100 Subject: edit req-030 --- requirements/catalogue/req-030.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-030.md b/requirements/catalogue/req-030.md index 38961be..09286df 100644 --- a/requirements/catalogue/req-030.md +++ b/requirements/catalogue/req-030.md @@ -38,7 +38,7 @@ Inputs: 8. If there is no transaction with the ID, `transaction_id`, then return FALSE. 9. Let `transaction` be the transaction with the ID, `transaction_id`. 10. If there is a transaction, `transaction_2`, such that - `transaction_2.date > transaction.date` and + `transaction_2.timestamp >= transaction.timestamp` and `transaction.bucket_id = bucket.id`, then return FALSE. 11. Return TRUE. -- cgit v1.2.3 From ea21b9246ca930c88b9092156767b437447b8280 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 14:36:26 +0100 Subject: edit req-030 --- requirements/catalogue/req-030.md | 2 -- 1 file changed, 2 deletions(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-030.md b/requirements/catalogue/req-030.md index 09286df..cb27f11 100644 --- a/requirements/catalogue/req-030.md +++ b/requirements/catalogue/req-030.md @@ -43,5 +43,3 @@ Inputs: 11. Return TRUE. Source: req-029 - -Satisfied by: dml-bucket, dml-drip -- cgit v1.2.3 From ee6d4d87ffe36fe286e9976a7785a83d0d340c92 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 14:41:01 +0100 Subject: add req-035 --- requirements/catalogue/req-030.md | 25 ++----------------------- requirements/catalogue/req-035.md | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 requirements/catalogue/req-035.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-030.md b/requirements/catalogue/req-030.md index cb27f11..2cb1bdd 100644 --- a/requirements/catalogue/req-030.md +++ b/requirements/catalogue/req-030.md @@ -12,8 +12,8 @@ Inputs: 2. If more than one bucket exists with the name, `name`, then panic. 3. Let `bucket` be the bucket with the given name. 4. Let `cache_key = bucket.balance_cache_key`. -5. Let `is_up_to_date` be the result of the sub-procedure, - `is_bucket_balance_up_to_date(bucket)`, as described below. +5. Let `is_up_to_date` be the result of the procedure, + `is_bucket_balance_up_to_date(bucket)`, as described in req-035. 6. If `is_up_to_date = TRUE`, then return `bucket.balance`. 7. Let `transaction_sum` be the sum over the property, `amount`, of all transactions `t` such that `t.bucket_id = bucket.id`. @@ -21,25 +21,4 @@ Inputs: that `d.bucket_id = bucket.id`. 9. Return `drip_sum - transaction_sum`. -## is_bucket_balance_up_to_date - -Inputs: - -- A bucket, `bucket` - -1. Let `cache_key = bucket.balance_cache_key`. -2. If `cache_key` is not in the format, `:`, then return FALSE. -3. Let `drip_id` be the part of `cache_key` before the `:`. -4. If there is no drip with the ID, `drip_id`, then return FALSE. -5. Let `drip` be the drip with the ID, `drip_id`. -6. If there is a drip, `drip_2`, such that `drip_2.date > drip.date` and - `drip.bucket_id = bucket.id`, then return FALSE. -7. Let `transaction_id` be the part of `cache_key` after the `:`. -8. If there is no transaction with the ID, `transaction_id`, then return FALSE. -9. Let `transaction` be the transaction with the ID, `transaction_id`. -10. If there is a transaction, `transaction_2`, such that - `transaction_2.timestamp >= transaction.timestamp` and - `transaction.bucket_id = bucket.id`, then return FALSE. -11. Return TRUE. - Source: req-029 diff --git a/requirements/catalogue/req-035.md b/requirements/catalogue/req-035.md new file mode 100644 index 0000000..0dc9aaf --- /dev/null +++ b/requirements/catalogue/req-035.md @@ -0,0 +1,27 @@ +# req-035 + +Schist must implement the procedure described below as +`is_bucket_balance_up_to_date`. + +## is_bucket_balance_up_to_date + +Inputs: + +- A bucket, `bucket` + +1. Let `cache_key = bucket.balance_cache_key`. +2. If `cache_key` is not in the format, `:`, then return FALSE. +3. Let `drip_id` be the part of `cache_key` before the `:`. +4. If there is no drip with the ID, `drip_id`, then return FALSE. +5. Let `drip` be the drip with the ID, `drip_id`. +6. If there is a drip, `drip_2`, such that `drip_2.date > drip.date` and + `drip.bucket_id = bucket.id`, then return FALSE. +7. Let `transaction_id` be the part of `cache_key` after the `:`. +8. If there is no transaction with the ID, `transaction_id`, then return FALSE. +9. Let `transaction` be the transaction with the ID, `transaction_id`. +10. If there is a transaction, `transaction_2`, such that + `transaction_2.timestamp >= transaction.timestamp` and + `transaction.bucket_id = bucket.id`, then return FALSE. +11. Return TRUE. + +Source: req-030 \ No newline at end of file -- cgit v1.2.3 From f346faadb1433b1aebce97aa3e829910ca5457b2 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 14:43:56 +0100 Subject: add req-036 --- requirements/catalogue/req-036.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 requirements/catalogue/req-036.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-036.md b/requirements/catalogue/req-036.md new file mode 100644 index 0000000..db3f4dd --- /dev/null +++ b/requirements/catalogue/req-036.md @@ -0,0 +1,7 @@ +# req-036 + +Given a bucket, `bucket`, if the procedure +`is_bucket_balance_up_to_date(bucket)` as described in req-035 returns TRUE, +then the accurate balance of `bucket` is equal to `bucket.balance`. + +Sources: req-030, req-032 \ No newline at end of file -- cgit v1.2.3 From 519721cd14e31fcc6998b387a27eaf3ad34d2869 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 15:09:31 +0100 Subject: add req-037 --- requirements/catalogue/req-030.md | 8 ++++--- requirements/catalogue/req-035.md | 4 ++-- requirements/catalogue/req-037.md | 48 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 requirements/catalogue/req-037.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-030.md b/requirements/catalogue/req-030.md index 2cb1bdd..e09a281 100644 --- a/requirements/catalogue/req-030.md +++ b/requirements/catalogue/req-030.md @@ -15,10 +15,12 @@ Inputs: 5. Let `is_up_to_date` be the result of the procedure, `is_bucket_balance_up_to_date(bucket)`, as described in req-035. 6. If `is_up_to_date = TRUE`, then return `bucket.balance`. -7. Let `transaction_sum` be the sum over the property, `amount`, of all +7. Carry out the procedure, `update_bucket_drips(bucket)`, as described in + req-037. +8. Let `transaction_sum` be the sum over the property, `amount`, of all transactions `t` such that `t.bucket_id = bucket.id`. -8. Let `drip_sum` be the sum over the property, `amount`, of all drips `d` such +9. Let `drip_sum` be the sum over the property, `amount`, of all drips `d` such that `d.bucket_id = bucket.id`. -9. Return `drip_sum - transaction_sum`. +10. Return `drip_sum - transaction_sum`. Source: req-029 diff --git a/requirements/catalogue/req-035.md b/requirements/catalogue/req-035.md index 0dc9aaf..15b797b 100644 --- a/requirements/catalogue/req-035.md +++ b/requirements/catalogue/req-035.md @@ -14,8 +14,8 @@ Inputs: 3. Let `drip_id` be the part of `cache_key` before the `:`. 4. If there is no drip with the ID, `drip_id`, then return FALSE. 5. Let `drip` be the drip with the ID, `drip_id`. -6. If there is a drip, `drip_2`, such that `drip_2.date > drip.date` and - `drip.bucket_id = bucket.id`, then return FALSE. +6. If there is a drip, `drip_2`, such that `drip_2.timestamp > drip.timestamp` + and `drip.bucket_id = bucket.id`, then return FALSE. 7. Let `transaction_id` be the part of `cache_key` after the `:`. 8. If there is no transaction with the ID, `transaction_id`, then return FALSE. 9. Let `transaction` be the transaction with the ID, `transaction_id`. diff --git a/requirements/catalogue/req-037.md b/requirements/catalogue/req-037.md new file mode 100644 index 0000000..0d27984 --- /dev/null +++ b/requirements/catalogue/req-037.md @@ -0,0 +1,48 @@ +# req-037 + +Schist must implement the procedure, described below as +`update_budget_drips_for_bucket`. + +## update_budget_drips_for_bucket + +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`: + - `bucket_id`: `pipe.bucket_id` + - `pipe_id`: `pipe.id` + - `date`: `d` + - `amount`: the result of the sub-procedure, `pipe_amount_for_day(pipe, d)` + as described below + - `timestamp`: now as a Unix timestamp + +## pipe_amount_for_date + +Inputs: + +- A pipe, `pipe` +- A calendar date, `date` + +1. If `pipe.period` is `day`, return `pipe.amount`. +2. If `pipe.period` is `week`, return `pipe.amount ÷ 7`. +3. Let `days_in_month` be the number of days in the month to which `date` + belongs. +4. If `pipe.period` is `month`, return `pipe.amount ÷ days_in_month`. +5. Let `days_in_year` be the number of days in the year to which `date` belongs. +6. If `period` is not `year`, panic. +7. Return `pipe.amount ÷ days_in_year`. + +Source: req-030 \ No newline at end of file -- cgit v1.2.3 From ec9138b80c6c2dcd03a8e3d0a79ca40e356d28a9 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 15:24:12 +0100 Subject: add req-038 --- requirements/catalogue/req-038.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 requirements/catalogue/req-038.md (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-038.md b/requirements/catalogue/req-038.md new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From 13ed038841fbfd7fb4f6baef00a55fbd22af21e5 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 15:24:20 +0100 Subject: add req-038 --- requirements/catalogue/req-038.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-038.md b/requirements/catalogue/req-038.md index e69de29..71b8d55 100644 --- a/requirements/catalogue/req-038.md +++ b/requirements/catalogue/req-038.md @@ -0,0 +1,6 @@ +# req-038 + +Schist must have a record of pipes which accurately reflect how I want to +distribute my incomings and outgoings. + +Source: req-032 \ No newline at end of file -- cgit v1.2.3 From 376e5623ef0a202c391908a7a3093df4d804a052 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 15 Jul 2025 17:30:35 +0100 Subject: rework --- requirements/catalogue/req-002.md | 2 -- requirements/catalogue/req-003.md | 9 +++++---- requirements/catalogue/req-004.md | 7 ++++--- requirements/catalogue/req-005.md | 3 ++- requirements/catalogue/req-018.md | 7 ++++--- requirements/catalogue/req-019.md | 7 ++++--- requirements/catalogue/req-020.md | 5 +++-- requirements/catalogue/req-024.md | 3 ++- requirements/catalogue/req-028.md | 10 ++++++---- requirements/catalogue/req-029.md | 4 +++- requirements/catalogue/req-032.md | 8 ++++++-- requirements/catalogue/req-034.md | 4 +++- 12 files changed, 42 insertions(+), 27 deletions(-) (limited to 'requirements/catalogue') diff --git a/requirements/catalogue/req-002.md b/requirements/catalogue/req-002.md index 3d87553..55fcb43 100644 --- a/requirements/catalogue/req-002.md +++ b/requirements/catalogue/req-002.md @@ -6,5 +6,3 @@ and I want having such buckets and pipes to enable me to control what I do with my money, so that I control what I do with my money. Source: req-001 - -Satisfied by: req-028, req-017, ass-002 diff --git a/requirements/catalogue/req-003.md b/requirements/catalogue/req-003.md index 6232329..0ec877e 100644 --- a/requirements/catalogue/req-003.md +++ b/requirements/catalogue/req-003.md @@ -1,9 +1,10 @@ # req-003 -As a user, I want how much money is in my beer bucket to influence how much I -spend on beer, so that having buckets and pipes which express how I want to -distribute, and have previously distributed, my incomings and outgoings enables -me to control my spending. +As a user, given I have a beer bucket and pipes which express how much I want +to spend on beer, I want how much money is in my beer bucket to influence how +much I spend on beer, so that having buckets and pipes which express how I want +to distribute, and have previously distributed, my incomings and outgoings +enables me to control my spending. Source: req-028 diff --git a/requirements/catalogue/req-004.md b/requirements/catalogue/req-004.md index e28a256..e39e58a 100644 --- a/requirements/catalogue/req-004.md +++ b/requirements/catalogue/req-004.md @@ -1,8 +1,9 @@ # req-004 -As a user, I want to consider how much money is in my beer bucket when I decide -how much to spend on beer at the bar, so that how much money is in my beer -bucket influences how much I spend on beer. +As a user, given I have a beer bucket and pipes which express how much I want to +spend on beer, I want to consider how much money is in my beer bucket when I +decide how much to spend on beer at the bar, so that how much money is in my +beer bucket influences how much I spend on beer. Source: req-003 diff --git a/requirements/catalogue/req-005.md b/requirements/catalogue/req-005.md index 79f00c7..523c285 100644 --- a/requirements/catalogue/req-005.md +++ b/requirements/catalogue/req-005.md @@ -1,6 +1,7 @@ # req-005 -As a user, I want to know how much money is in my beer bucket when I'm at the +As a user, given I have a beer bucket and pipes which express how much I want to +spend on beer, I want to know how much money is in my beer bucket when I'm at the bar, so that I can consider how much money is in my beer bucket when I decide how much to spend on beer at the bar. diff --git a/requirements/catalogue/req-018.md b/requirements/catalogue/req-018.md index 9b9db42..225fc5d 100644 --- a/requirements/catalogue/req-018.md +++ b/requirements/catalogue/req-018.md @@ -1,8 +1,9 @@ # req-018 -As a user, I want to know how much money is in my beer bucket when I'm at the -bar and I have access to my phone, so that I can know how much money is in my -beer bucket when I'm at the bar. +As a user, given I have a beer bucket and pipes which express how much I want +to spend on beer, I want to know how much money is in my beer bucket when I'm at +the bar and I have access to my phone, so that I can know how much money is in +my beer bucket when I'm at the bar. Source: req-005 diff --git a/requirements/catalogue/req-019.md b/requirements/catalogue/req-019.md index a4d908a..35a7162 100644 --- a/requirements/catalogue/req-019.md +++ b/requirements/catalogue/req-019.md @@ -1,8 +1,9 @@ # req-019 -As a user, I want to know how much money is in my beer bucket when I'm at the -bar and I don't have access to my phone, so that I can know how much money is -in my beer bucket when I'm at the bar. +As a user, given I have a beer bucket and pipes which express how much I want to +spend on beer, I want to know how much money is in my beer bucket when I'm at +the bar and I don't have access to my phone, so that I can know how much money +is in my beer bucket when I'm at the bar. Source: req-005 diff --git a/requirements/catalogue/req-020.md b/requirements/catalogue/req-020.md index cbc5e5e..1e3eeb0 100644 --- a/requirements/catalogue/req-020.md +++ b/requirements/catalogue/req-020.md @@ -1,7 +1,8 @@ # req-020 -As a user, I want to find out my beer bucket balance in Schist using SMS, so -that I can know how much money is in my beer bucket when I'm at the bar and I +As a user, given I have a beer bucket and pipes which express how much I want +to spend on beer, I want to find out my beer bucket balance in Schist using SMS, +so that I can know how much money is in my beer bucket when I'm at the bar and I have access to my phone. Source: req-018 diff --git a/requirements/catalogue/req-024.md b/requirements/catalogue/req-024.md index 5119d3e..efbc3a6 100644 --- a/requirements/catalogue/req-024.md +++ b/requirements/catalogue/req-024.md @@ -1,6 +1,7 @@ # req-023 -As a user, I want Schist to be able to infer the accurate balance of my beer +As a user, given I have a beer bucket and pipes which express how much I want to +spend on beer, I want Schist to be able to infer the accurate balance of my beer bucket, so that I can find out my beer balance in Schist using SMS. Source: req-020 diff --git a/requirements/catalogue/req-028.md b/requirements/catalogue/req-028.md index 6832c9e..e86c525 100644 --- a/requirements/catalogue/req-028.md +++ b/requirements/catalogue/req-028.md @@ -1,9 +1,11 @@ # req-028 -As a user, I want how much money is in my buckets to influence how much I spend -on the real categories of spending which they represent, so that having buckets -and pipes which express how I want to distribute, and have previously -distributed, my incomings and outgoings enables me to control my spending. +As a user, given my buckets and pipes express how I want to distribute my +incomings and outgoings, I want how much money is in my buckets to influence +how much I spend on the real categories of spending which they represent, so +that having buckets and pipes which express how I want to distribute, and have +previously distributed, my incomings and outgoings enables me to control my +spending. Source: req-002 diff --git a/requirements/catalogue/req-029.md b/requirements/catalogue/req-029.md index 24eb7c1..26bf701 100644 --- a/requirements/catalogue/req-029.md +++ b/requirements/catalogue/req-029.md @@ -1,5 +1,7 @@ # req-029 -Schist must have an SMS interface for reading the balance of a given bucket. +Given the user's buckets and pipes express how the user wants to distribute +their incomings and outgoings, Schist must have an SMS interface for a +procedure which returns the accurate balance of a given bucket. Source: req-020 \ No newline at end of file diff --git a/requirements/catalogue/req-032.md b/requirements/catalogue/req-032.md index aa08be1..6f173ac 100644 --- a/requirements/catalogue/req-032.md +++ b/requirements/catalogue/req-032.md @@ -1,5 +1,9 @@ # req-032 -Schist must be able to infer the accurate balance of any given bucket. +Given the user's buckets and pipes express how the user wants to distribute +their incomings and outgoings, Schist must be able to infer the accurate balance +of any given bucket. -Source: req-024 \ No newline at end of file +Source: req-024 + +Satisfied by: req-030, req-034, ass-008, req-036 \ No newline at end of file diff --git a/requirements/catalogue/req-034.md b/requirements/catalogue/req-034.md index d8e2137..9971dd2 100644 --- a/requirements/catalogue/req-034.md +++ b/requirements/catalogue/req-034.md @@ -2,4 +2,6 @@ Schist must have an accurate record of my transactions. -Source: req-032 \ No newline at end of file +Source: req-032 + +Satisfied by: req-033, ass-009 \ No newline at end of file -- cgit v1.2.3