Skip to content

Conversation

@devksingh4
Copy link
Member

@devksingh4 devksingh4 commented Nov 6, 2025

Handles our new iCard swiper, which outputs format "ACMCARD(4 digits)(UIN)(otherstuff)"

Summary by CodeRabbit

  • New Features
    • Added ACM card scanning support to the ticket entry flow. Users can now scan their physical ACM card to automatically retrieve their event tickets, replacing the need for manual identity entry. Invalid scans provide helpful error feedback.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

A 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

Cohort / File(s) Summary
ACM Card Swipe Input Handling
src/ui/pages/tickets/ScanTickets.page.tsx
Added conditional logic to detect and validate ACMCARD-prefixed swipe input, extract the 9-digit UIN, and set error state if validation fails. Integrates with existing UIN, NetID, and Email input branches.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Localized change to a single file with straightforward string validation and parsing logic
  • Integration follows existing UIN/NetID/Email input patterns with minimal branching complexity

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Implement handling for new iCard swiper' accurately describes the main change: adding parsing and handling logic for a new iCard swiper output format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dsingh14/icard-swipe

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

💰 Infracost report

Monthly estimate generated

This comment will be updated when code changes.

@devksingh4 devksingh4 merged commit 3bdd0f4 into main Nov 6, 2025
8 of 10 checks passed
@devksingh4 devksingh4 deleted the dsingh14/icard-swipe branch November 6, 2025 20:01
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 email is immediately used in the UIN-to-email conversion below, the current approach is acceptable.

📜 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

📥 Commits

Reviewing files that changed from the base of the PR and between 838b40b and 858aeae.

📒 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

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