-
Notifications
You must be signed in to change notification settings - Fork 0
Implement handling for new iCard swiper #383
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
WalkthroughA single file modification adds ACM card swipe input handling to the ticket scanning flow. The change validates card format, extracts a 9-digit UIN from the swipe data, and integrates with the existing UIN-to-email resolution and ticket retrieval pipeline. Changes
Sequence DiagramsequenceDiagram
participant User
participant ManualEntry as Manual Entry Form
participant Validator as Input Validator
participant UINResolver as UIN-to-Email Resolver
participant TicketAPI as Ticket API
User->>ManualEntry: Swipe/Enter ACM Card
ManualEntry->>Validator: Check if starts with ACMCARD
alt Valid ACMCARD Format
Validator->>Validator: Extract 9-digit UIN
Validator->>UINResolver: Resolve UIN to Email
UINResolver->>TicketAPI: Retrieve Tickets
TicketAPI-->>User: Display Tickets
else Invalid Format
Validator->>ManualEntry: Set Error State
ManualEntry->>User: Show Error Modal
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
💰 Infracost reportMonthly estimate generatedThis comment will be updated when code changes. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/ui/pages/tickets/ScanTickets.page.tsx (1)
567-577: ACMCARD parsing logic looks correct.The implementation correctly handles the new iCard swiper format:
- Regex pattern accurately matches
ACMCARD+ 4 digits + 9-digit UIN- Properly extracts the UIN and integrates with existing UIN-to-email flow
- Error handling is appropriate with generic message for security
Consider these optional improvements for maintainability:
1. Add a comment documenting the format:
+ // Check if input is from ACM card swiper + // Format: ACMCARD<4-digit prefix><9-digit UIN><additional data> + // Example: ACMCARD1234567890123... if (email.startsWith("ACMCARD")) {2. Use a more descriptive variable name temporarily:
if (email.startsWith("ACMCARD")) { const uinMatch = email.match(/^ACMCARD(\d{4})(\d{9})/); if (!uinMatch) { setError("Invalid card swipe. Please try again."); setIsLoading(false); setShowModal(true); return; } - email = uinMatch[2]; // Extract the 9-digit UIN + const uin = uinMatch[2]; // Extract the 9-digit UIN + email = uin; }Though since
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
src/ui/pages/tickets/ScanTickets.page.tsx(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Required Reviews
src/ui/pages/tickets/ScanTickets.page.tsx
[error] 1-1: Requirement "Base Requirement" is not satisfied by the existing reviews.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Application
- GitHub Check: Run Unit Tests
Handles our new iCard swiper, which outputs format "ACMCARD(4 digits)(UIN)(otherstuff)"
Summary by CodeRabbit