-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added simple mutations page #99
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far! Once you reckon it's review-ready, I'll approve.
@@ -247,6 +265,7 @@ def print(s): | |||
sale_trans.save() | |||
sale_trans_id += 1 | |||
|
|||
status = choice(list(TransactionType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does mean that non-board members are seeded to make product mutations. Maybe it might be nicer to do the product mutations in separate pass where the user is fixed as the board user?
product_amount = Product.objects.count() | ||
total_balance = sum(user.balance for user in User.objects.all()) | ||
|
||
# Filter transactions by status ('Sale' in this case) | ||
product_sales = ProductTransactions.objects.filter(status=TransactionType.SALE).prefetch_related('transaction_id').order_by('transaction_id__date').reverse() | ||
|
||
# Group sales by transaction | ||
product_sale_groups = [] | ||
for designation, member_group in groupby(product_sales, lambda sale: sale.transaction_id): | ||
product_sale_groups.append({"key": designation, "values": list(member_group)}) | ||
|
||
# Paginate the sales groups | ||
sales_page = create_paginator(product_sale_groups[:5], request.GET.get("sales")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not used in the view logic nor in the template.
No description provided.