-
Notifications
You must be signed in to change notification settings - Fork 148
fix(500): item to product renames #1350
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
Conversation
Reviewer's GuideThis PR completes the migration from the old item-based API/model naming to product-based naming across JSON export, PDF preview generation, event cancellation, check-in forms, tax rule deletion checks, and several control templates, fixing 500 errors caused by stale item references. Sequence diagram for event JSON export using products instead of itemssequenceDiagram
actor Organizer
participant ControlPanel
participant JSONExporter
participant Event
participant ProductManager as EventProducts
participant OrderPositions
Organizer->>ControlPanel: Request_event_JSON_export
ControlPanel->>JSONExporter: render(event)
JSONExporter->>Event: get_categories()
Event-->>JSONExporter: categories_queryset
JSONExporter->>ProductManager: event.products.select_related_tax_rule_prefetch_variations
ProductManager-->>JSONExporter: products_queryset
loop For_each_product
JSONExporter->>ProductManager: access_product_fields_and_variations
ProductManager-->>JSONExporter: product_data_and_variations
end
JSONExporter->>OrderPositions: get_positions_for_event
OrderPositions-->>JSONExporter: positions_with_product_and_variation
loop For_each_position
JSONExporter->>OrderPositions: read_product_id_price_and_attendee_data
OrderPositions-->>JSONExporter: position_data_with_product_id
end
JSONExporter->>Event: get_quotas_with_products_and_variations
Event-->>JSONExporter: quotas_queryset
loop For_each_quota
JSONExporter->>Event: quota.products_and_variations
Event-->>JSONExporter: product_ids_and_variation_ids
end
JSONExporter-->>ControlPanel: JSON_payload_with_products
ControlPanel-->>Organizer: Return_JSON_response
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `app/eventyay/control/views/pdf.py:87` </location>
<code_context>
- order.positions.create(item=item2, attendee_name_parts=sample, price=item.default_price, addon_to=p)
- order.positions.create(item=item2, attendee_name_parts=sample, price=item.default_price, addon_to=p)
+ p = order.positions.create(product=product, attendee_name_parts=sample, price=product.default_price)
+ order.positions.create(product=product2, attendee_name_parts=sample, price=product.default_price, addon_to=p)
+ order.positions.create(product=product2, attendee_name_parts=sample, price=product.default_price, addon_to=p)
</code_context>
<issue_to_address>
**issue (bug_risk):** Use product2.default_price when creating positions for product2 to avoid inconsistent sample data.
These two positions are for `product2`, but both use `product.default_price` instead of `product2.default_price`. This makes the sample position prices inaccurate and could hide layout issues that depend on the correct price. Please switch both lines to use `product2.default_price` so each sample position matches its product’s default price.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Pull request overview
This PR addresses 500 errors caused by incomplete migration from item to product terminology across the eventyay codebase. The changes ensure consistency in variable names, model field references, URL patterns, and log actions.
- Updates URL patterns and template references from
event.itemstoevent.products - Renames variables and model field parameters from
itemtoproduct - Updates JSON export structure to use
productsinstead ofitems
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/eventyay/eventyay_common/templates/eventyay_common/events/index.html | Updates URL pattern for quota management from event.items.quotas to event.products.quotas |
| app/eventyay/eventyay_common/templates/eventyay_common/event/settings_base.html | Updates URL pattern for product creation from event.items.add to event.products.add |
| app/eventyay/control/views/pdf.py | Renames variables and updates OrderPosition creation to use product= parameter instead of item= |
| app/eventyay/control/forms/checkin.py | Updates queryset from event.items.all() to event.products.all() for check-in form product limits |
| app/eventyay/base/services/cancelevent.py | Updates queryset and log action when deactivating products during event cancellation |
| app/eventyay/base/models/tax.py | Updates validation in allow_delete method to check event.products instead of event.items |
| app/eventyay/base/exporters/json.py | Updates JSON export structure to use products key and product_id field references throughout |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR fixes a few 500 errors caused due to
item->productrename like accessing the "My Events" pageSummary by Sourcery
Align event data and UI flows with the new product naming to prevent runtime errors related to the item→product migration.
Bug Fixes: