Skip to content

Conversation

@choonkeat
Copy link
Owner

Update Go's EqualsField comparison to check if ANY value from one
field matches ANY value from another field, matching Elm's behavior.

Previous implementation:

  • Used values.Get() which only compared first values
  • fieldA[0] == fieldB[0]

New implementation:

  • Iterates through all values from both fields
  • Returns true if any value overlaps
  • Handles both single-value and multi-value fields correctly

This ensures consistent behavior between Go backend validation
and Elm frontend logic for multi-select fields, checkboxes, etc.

choonkeat and others added 2 commits November 12, 2025 17:12
Add test cases to verify that EqualsField comparison should check
if ANY value from one field matches ANY value from another field,
aligning with Elm's behavior. Current Go implementation only compares
first values, causing the test to fail.

Test case shows:
- skills: ["Go", "Elm"]
- preferred_skills: ["Python", "Elm", "JavaScript"]
- Expected: "Elm" overlap means condition is met (field hidden)
- Current: "Go" != "Python" so condition fails (field visible)

Equivalent Elm integration tests for EqualsField with multi-value fields
passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update Go's EqualsField comparison to check if ANY value from one
field matches ANY value from another field, matching Elm's behavior.

Previous implementation:
- Used values.Get() which only compared first values
- fieldA[0] == fieldB[0]

New implementation:
- Iterates through all values from both fields
- Returns true if any value overlaps
- Handles both single-value and multi-value fields correctly

This ensures consistent behavior between Go backend validation
and Elm frontend logic for multi-select fields, checkboxes, etc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for tiny-form-fields ready!

Name Link
🔨 Latest commit d33f949
🔍 Latest deploy log https://app.netlify.com/projects/tiny-form-fields/deploys/69145022828b8500077ac410
😎 Deploy Preview https://deploy-preview-53--tiny-form-fields.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@choonkeat choonkeat merged commit 5c2b572 into main Nov 12, 2025
6 checks passed
@choonkeat choonkeat deleted the fix-go-equals-fields branch November 12, 2025 09:32
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