diff --git a/development_notebook/2024-03-06.md b/development_notebook/2024-03-06.md new file mode 100644 index 0000000..c5fc527 --- /dev/null +++ b/development_notebook/2024-03-06.md @@ -0,0 +1,33 @@ +# Current State + +See [[2024-03-05]] for previous log. + +To perform tasks required in the previous log some environment configuration was nedded - namedly, configure code completion and go to definiton. + +# Today + +The environment has been further configured. Add relevant information to [[Configuration Work]]. +Most relevant usage of tools are in [[tools]]. This is to be updated as commands become trivial and new commands are learned. + +Work continued on from last log. + +## Work Log + +__InProgress__ +~~* Implement improved solution.~~ + ~~- It does not - Requires change from timezone to datetime~~ + +* Define balance property, as well as relevant new db fields - assuming fields defined in Transaction. + +__ToDo__ +* Define fields and functions in Transaction. Check FieldTracker in model\_utils. +* Migrate. +* Test on admin. + +__Done__ +* Fix errors called out by IDE. + + +# To Do +[[Configuration Work]] Configure git actions to not lint these logs. +[[tools]] diff --git a/development_notebook/tools.md b/development_notebook/tools.md index 24f086f..96e2cc7 100644 --- a/development_notebook/tools.md +++ b/development_notebook/tools.md @@ -21,6 +21,12 @@ tmux attach-session -t \ ## NVim +:sp \ + ? Split vertical + +:vsp \ + ? Split horizontal + ### TODO -> Include plugin commands ## Bash @@ -28,4 +34,14 @@ tmux attach-session -t \ `w` ? Shows processes running +`ESC + b` + ? Equivalent to `Ctrl + \` + +`ESC + l` + ? Equivalent to `Ctrl + \` + +`ESC + \` + ? Equivalent to `Ctrl + \` +`Ctrl + R` then `Enter` + ? Search command history. Press `Enter` for next result. diff --git a/negligent_octopus/core/models.py b/negligent_octopus/core/models.py index 2b0df5d..683ee21 100644 --- a/negligent_octopus/core/models.py +++ b/negligent_octopus/core/models.py @@ -1,9 +1,8 @@ -from datetime import datetime from django.db import models +from django.utils import timezone from model_utils.models import SoftDeletableModel from model_utils.models import TimeStampedModel - from negligent_octopus.users.models import User @@ -11,21 +10,23 @@ class Account(TimeStampedModel, SoftDeletableModel): owner = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharField(max_length=255) calculated_balance = models.FloatField(default=0.0, editable=False) - calculated_at = models.DateTimeField(default=datetime.now) # Uses datetime.datetime instead of auto_add_now because the latter uses django.timezone + calculated_at = models.DateTimeField(auto_now_add=True) - @propery + @property def balance(self): # Set calculated_at to now (now_at) # Get relevant transaction (Get creation or modified after now_at) - # For each do a running sum, taking in consideration delta of all modifications after now_at - # Check for any modification on is_removed and consider into the delta (just negative of last calculation - is this correct?) + # For each do a running sum + # taking in consideration delta of all modifications after now_at + # Check for any modification on is_removed (just negative of last calculation?) # Update calculated_balance and return it - # #IMPROVE : Evaluate using atomic or another techinique to prevent conflicts on reading and updating + # #IMPROVE : Evaluate using atomic or another techinique to prevent conflicts + pass def __str__(self): return self.name - class Meta: + class Meta(TimeStampedModel.Meta, SoftDeletableModel.Meta): verbose_name = "Account" verbose_name_plural = "Accounts" ordering = ["-modified", "name"] @@ -44,7 +45,7 @@ def get_account_owner(self): def __str__(self): return self.title - class Meta: + class Meta(TimeStampedModel.Meta): verbose_name = "Transaction" verbose_name_plural = "Transactions" ordering = ["date", "-modified"]