Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SamStaijen
Copy link
Member

No description provided.

@SamStaijen SamStaijen self-assigned this Mar 13, 2025
Copy link
Member

@stickyPiston stickyPiston left a 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))
Copy link
Member

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?

Comment on lines +484 to +496
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"))
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants