diff --git a/api/__pycache__/settings.cpython-313.pyc b/api/__pycache__/settings.cpython-313.pyc index a174e29b..6f12e0ef 100644 Binary files a/api/__pycache__/settings.cpython-313.pyc and b/api/__pycache__/settings.cpython-313.pyc differ diff --git a/app/__pycache__/models.cpython-313.pyc b/app/__pycache__/models.cpython-313.pyc index 710e3f98..d4e08c10 100644 Binary files a/app/__pycache__/models.cpython-313.pyc and b/app/__pycache__/models.cpython-313.pyc differ diff --git a/app/__pycache__/workflow_utils.cpython-313.pyc b/app/__pycache__/workflow_utils.cpython-313.pyc index 5ded5f24..2c2998d4 100644 Binary files a/app/__pycache__/workflow_utils.cpython-313.pyc and b/app/__pycache__/workflow_utils.cpython-313.pyc differ diff --git a/app/migrations/0366_payment_schedule_batch_date.py b/app/migrations/0366_payment_schedule_batch_date.py new file mode 100644 index 00000000..355fc2da --- /dev/null +++ b/app/migrations/0366_payment_schedule_batch_date.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.7 on 2026-01-26 03:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0365_payment_schedule_penalty_paid_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='payment_schedule', + name='batch_date', + field=models.DateField(null=True), + ), + ] diff --git a/app/models.py b/app/models.py index ecb2c9c6..6a11d0cc 100644 --- a/app/models.py +++ b/app/models.py @@ -1700,6 +1700,7 @@ class Payment_Schedule(AutoCodeModel): updater = models.ForeignKey(User, null=False, related_name='+', on_delete=models.PROTECT) entry = models.JSONField(null=True) detail = models.JSONField(null=True) + batch_date = models.DateField(null=True) ovd_days = models.IntegerField(null=True) penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2) penalty_paid = models.DecimalField(null=True, max_digits=15, decimal_places=2) diff --git a/app/workflow_utils.py b/app/workflow_utils.py index c183069a..430c7618 100644 --- a/app/workflow_utils.py +++ b/app/workflow_utils.py @@ -321,17 +321,34 @@ def resolve_value(expr, context): # ============================================= # $append(list, element) if re.match(r'^\$append\(', expr, re.IGNORECASE): - match = re.match(r'^\$append\((.*)\)$', expr, re.IGNORECASE) + match = re.match(r"^\$append\(([^,]+),\s*(.+)\)$", expr, re.DOTALL) if match: - args = split_args(match.group(1)) - if len(args) == 2: - target_list = resolve_value(args[0], context) - element = resolve_value(args[1], context) - if not isinstance(target_list, list): - target_list = [] - result = list(target_list) - result.append(element) - return result + list_expr = match.group(1).strip() + element_expr = match.group(2).strip() + + # 1. Resolve the list + target_list = resolve_value(list_expr, context) + if target_list is None: + target_list = [] + + # Ensure it's a copy so we don't modify the original context variable directly + target_list = list(target_list) + + # 2. Resolve the element + resolved_element = resolve_value(element_expr, context) + + if isinstance(resolved_element, str): + try: + import json + element_to_append = json.loads(resolved_element) + except json.JSONDecodeError: + element_to_append = resolved_element + else: + element_to_append = resolved_element + + target_list.append(element_to_append) + return target_list + # $first(list), $last(list) if re.match(r'^\$(first|last)\(', expr, re.IGNORECASE):