mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-16 01:32:41 +02:00
feat: improve transaction ordering on calendar
This commit is contained in:
@@ -37,7 +37,12 @@ def get_transactions_by_day(year, month):
|
|||||||
# Get all transactions for the month
|
# Get all transactions for the month
|
||||||
transactions = Transaction.objects.filter(
|
transactions = Transaction.objects.filter(
|
||||||
date__year=year, date__month=month
|
date__year=year, date__month=month
|
||||||
).order_by("date")
|
).order_by(
|
||||||
|
"date",
|
||||||
|
"-type",
|
||||||
|
"-is_paid",
|
||||||
|
"id",
|
||||||
|
)
|
||||||
|
|
||||||
# Calculate padding days needed
|
# Calculate padding days needed
|
||||||
padding_days = first_day.weekday() # Monday is 0, Sunday is 6
|
padding_days = first_day.weekday() # Monday is 0, Sunday is 6
|
||||||
|
|||||||
@@ -66,7 +66,12 @@ def calendar_list(request, month: int, year: int):
|
|||||||
@require_http_methods(["GET"])
|
@require_http_methods(["GET"])
|
||||||
def calendar_transactions_list(request, day: int, month: int, year: int):
|
def calendar_transactions_list(request, day: int, month: int, year: int):
|
||||||
date = datetime.date(year=year, month=month, day=day)
|
date = datetime.date(year=year, month=month, day=day)
|
||||||
transactions = Transaction.objects.filter(date=date)
|
transactions = Transaction.objects.filter(date=date).order_by(
|
||||||
|
"date",
|
||||||
|
"-type",
|
||||||
|
"-is_paid",
|
||||||
|
"id",
|
||||||
|
)
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
|
|||||||
Reference in New Issue
Block a user