mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-25 08:39:42 +00:00
Add hide_missing_ids filter to transaction queries
- Add hide_missing_ids parameter to database functions to filter out transactions without internalTransactionId - Update API routes to support the new filter parameter - Update unit tests to include the new parameter - Add opencode.json configuration file
This commit is contained in:
committed by
Elisiário Couto
parent
c5fd26cb3e
commit
947342e196
@@ -210,6 +210,7 @@ def get_transactions(
|
||||
min_amount=None,
|
||||
max_amount=None,
|
||||
search=None,
|
||||
hide_missing_ids=True,
|
||||
):
|
||||
"""Get transactions from SQLite database with optional filtering"""
|
||||
from pathlib import Path
|
||||
@@ -249,6 +250,11 @@ def get_transactions(
|
||||
query += " AND description LIKE ?"
|
||||
params.append(f"%{search}%")
|
||||
|
||||
if hide_missing_ids:
|
||||
query += (
|
||||
" AND internalTransactionId IS NOT NULL AND internalTransactionId != ''"
|
||||
)
|
||||
|
||||
# Add ordering and pagination
|
||||
query += " ORDER BY transactionDate DESC"
|
||||
|
||||
@@ -397,6 +403,11 @@ def get_transaction_count(account_id=None, **filters):
|
||||
query += " AND description LIKE ?"
|
||||
params.append(f"%{filters['search']}%")
|
||||
|
||||
if filters.get("hide_missing_ids", True):
|
||||
query += (
|
||||
" AND internalTransactionId IS NOT NULL AND internalTransactionId != ''"
|
||||
)
|
||||
|
||||
try:
|
||||
cursor.execute(query, params)
|
||||
count = cursor.fetchone()[0]
|
||||
|
||||
Reference in New Issue
Block a user