Skip to content

fix: use correct Ticket field names in Grayquest fee header calculation - #22

Merged
sankarsubramaniankvs merged 2 commits into
developfrom
fix-ticket-fee-header-field-names
Jun 16, 2026
Merged

fix: use correct Ticket field names in Grayquest fee header calculation#22
sankarsubramaniankvs merged 2 commits into
developfrom
fix-ticket-fee-header-field-names

Conversation

@Awarth

@Awarth Awarth commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • _get_ticket_fee_headers and _calculate_grade_breakdown were reading Ticket fields using incorrect custom_-prefixed field names
  • These fields do not exist on the Ticket DocType under those names, so every lookup silently returned None
  • As a result, the Grayquest payload always fell back to the generic {total_payable, current_payable} values instead of the grade-specific fee header sourced from Event Listing grade_details

Fix

  • Replaced the incorrect custom_-prefixed field names with the actual field names present on the Ticket DocType
  • Fee headers now resolve correctly per grade from Event Listing grade_details

Test Plan

  • Create a Ticket linked to an Event Listing that has grade_details populated
  • Trigger the Grayquest payload generation and confirm the fee header reflects the grade-specific values, not the generic fallback
  • Verify behaviour is unchanged for Tickets where no matching grade detail exists (fallback should still apply)

- Replace custom_selected_payment_gateway with payment_gateway_type
- Replace custom_selected_payment_gateway_name with payment_gateway_account
- Replace custom_seat_pricing_total with seat_pricing_total
- Replace custom_free_seats_count with free_seats_count
- Replace custom_chargeable_seats_count with chargeable_seats_count

The incorrect custom_ prefix caused _get_ticket_fee_headers and
_calculate_grade_breakdown to read None from the Ticket doc, making
the fee_headers payload always fall back to {total_payable, current_payable}
instead of using the grade-specific fee header from Event Listing grade_details.

@sankarsubramaniankvs sankarsubramaniankvs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review — PR #22

Reviewer: OpenClaw Bot
Verdict: 🔄 Request Changes
Files reviewed: 1 | Issues found: 🔴 0 🟠 1 🟡 0 💡 0


Summary

The fix itself looks directionally right: the old custom_-prefixed field reads were clearly wrong if those fields do not exist on Ticket, and switching to the actual Ticket field names should unblock the grade-specific fee-header path. The scope is also clean and focused.

But this is still a backend behavior fix that changes payload construction logic, and the PR only includes a manual test plan. Under the review rule for backend changes, missing automated coverage is a merge blocker.


🌟 What's Done Well

  • The change is narrowly scoped to the broken field lookups instead of mixing in unrelated cleanup.
  • The PR description explains the failure mode clearly, including the exact fallback behavior this bug was causing.

🟠 Major

grayquest/utils/utils.py — Backend behavior fix has no automated regression coverage
This PR changes the logic that builds Grayquest fee headers and per-grade breakdown values, but it ships without a unit test or an update to an existing relevant test. That leaves the corrected field mapping and the fallback behavior unprotected against future regressions.

Suggested fix: add backend tests covering at least:

  • correct fee-header resolution when the Ticket has matching grade details and valid gateway fields
  • fallback to {total_payable, current_payable} when no matching grade detail exists
  • multi-grade breakdown using the corrected seat/count fields

File-by-File Summary

File Status Issues
grayquest/utils/utils.py 🟠 Missing required backend regression coverage for payload logic change

🤖 Reviewed by OpenClaw Bot — Unity Edu

- Test grade-specific fee header returned when grade + gateway match
- Test fallback to total_payable/current_payable when no match
- Test empty seats fallback
- Test multi-grade per-grade fee header breakdown
- Test multi-grade fallback when no grade_details configured
@sankarsubramaniankvs

Copy link
Copy Markdown

🔍 Code Review — PR #22

Reviewer: OpenClaw Bot
Verdict: ✅ Approve
Files reviewed: 2 | Issues found: 🔴 0 🟠 0 🟡 0 💡 0


Summary

Rechecked from the latest head. The previous blocker is addressed: the PR now includes backend unit coverage for the corrected Ticket field mappings, the grade-specific fee-header path, and the fallback behavior when no matching grade detail exists.

The fix remains narrowly scoped, and the new tests cover the behavior that was actually broken instead of only checking happy-path output. Clear now.


🌟 What's Done Well

  • Good follow-through on the missing coverage: the tests protect both the corrected field reads and the fallback logic.
  • The multi-grade case is covered too, which matters because _calculate_grade_breakdown was also reading the wrong Ticket fields.

File-by-File Summary

File Status Issues
grayquest/utils/utils.py Correct Ticket field names used for fee-header logic
grayquest/utils/test_utils.py Relevant regression coverage added for fee-header and fallback behavior

🤖 Reviewed by OpenClaw Bot — Unity Edu

@sankarsubramaniankvs
sankarsubramaniankvs merged commit 04beafe into develop Jun 16, 2026
@sankarsubramaniankvs
sankarsubramaniankvs deleted the fix-ticket-fee-header-field-names branch June 16, 2026 13:51
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