-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c28eca
commit 5c9a9a9
Showing
5 changed files
with
169 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Current State | ||
|
||
See [[2024-03-06]] for previous log. | ||
|
||
Deployed to production at [negligentoctopus.pythonanywhere.com](negligentoctopus.pythonanywhere.com). | ||
|
||
Project has been fully configured from cookiecutter-django using MySQL. | ||
|
||
Core models are being defined and added to the django-admin interface to be tested. | ||
|
||
## Update | ||
|
||
Account and transactions are implemented with balance as prefix-sum. | ||
|
||
# Today | ||
|
||
Define automatic balance tracking in account. | ||
|
||
Prefix-sum: This requires a strict ordering. When adding, deleting or changing the amount: Just add it according to the ordering, then update balance on all transactions that follow. The problem here is that we'll change many transactions, so having such a big lock is not a good ideia, and without having a lock we might access a transaction before it is updated. | ||
- Strict Ordering: is implemented by standard on django model Meta.order\_by | ||
|
||
## Work Log | ||
__InProgress__ | ||
|
||
__ToDo__ | ||
* Implement changeable to amt | ||
* Implement changeable to timestamp | ||
* Implement initial balance to accounts - change balance on transation to be relative and set a balance property | requires change to update_after and prev to use new field | ||
|
||
__Done__ | ||
* Implement balance as prefix-sum. | ||
* Migrate. | ||
* Test on admin. | ||
|
||
# To Do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
negligent_octopus/core/migrations/0002_transaction_account_add_balance.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 4.2.10 on 2024-03-18 00:12 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("core", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="transaction", | ||
options={ | ||
"ordering": ["-timestamp", "-created"], | ||
"verbose_name": "Transaction", | ||
"verbose_name_plural": "Transactions", | ||
}, | ||
), | ||
migrations.RemoveField( | ||
model_name="account", | ||
name="balance", | ||
), | ||
migrations.AddField( | ||
model_name="transaction", | ||
name="balance", | ||
field=models.FloatField(editable=False, null=True), | ||
), | ||
migrations.AddField( | ||
model_name="transaction", | ||
name="timestamp", | ||
field=models.DateTimeField(default=django.utils.timezone.now), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="transaction", | ||
unique_together={("timestamp", "created")}, | ||
), | ||
migrations.RemoveField( | ||
model_name="transaction", | ||
name="date", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters