Skip to content

Fix hardcoded mock data in getMatches function#5

Open
dillonvargo wants to merge 1 commit into
mainfrom
devin/1757630485-fix-hardcoded-matches
Open

Fix hardcoded mock data in getMatches function#5
dillonvargo wants to merge 1 commit into
mainfrom
devin/1757630485-fix-hardcoded-matches

Conversation

@dillonvargo

Copy link
Copy Markdown
Owner

Fix hardcoded mock data in getMatches function

Summary

Replaces hardcoded movie and food match arrays in the getMatches function with real matching logic that uses actual user preferences. The function now:

  • Retrieves real user IDs from session data instead of using mock user IDs
  • Loads actual user responses from localStorage
  • Converts response format from {category: {itemId: response}} to {category: {yes: [itemIds], no: [itemIds]}}
  • Uses the existing findMatches utility to compute matches based on overlapping "yes" responses
  • Maintains the same return format {movieMatches: [], foodMatches: []} for UI compatibility

Review & Testing Checklist for Human

⚠️ 4 items - this change involves data format conversion and untested integration

  • Test full user flow: Create a session with two users, have them swipe on movies and foods with some overlapping "yes" responses, and verify the results screen shows the correct matches
  • Test edge cases: Verify behavior with no matches, partial matches (only movies OR only foods), missing session data, and malformed localStorage data
  • Verify data format conversion: Check that the conversion logic correctly transforms stored responses {movies: {id1: 'yes', id2: 'no'}} into the expected format {movies: {yes: ['id1'], no: ['id2']}}
  • Validate session structure: Ensure the session data structure matches what the code expects (sessionData.users array with user IDs)

Notes

  • This fixes the core issue where matches were always the same hardcoded items regardless of user preferences
  • The most complex part is the data format conversion between storage format and what the findMatches utility expects
  • Error handling is included for localStorage failures, but edge cases around malformed data may need additional testing
  • Link to Devin run: https://app.devin.ai/sessions/f58125de643c43b7a48f5ef633165ea5
  • Requested by: @dillonvargo

- Import findMatches utility from ../utils/matchLogic
- Replace hardcoded movie/food ID arrays with actual user preference matching
- Get real user IDs from session data instead of using mock user IDs
- Convert response format from {category: {itemId: response}} to {category: {yes: [itemIds], no: [itemIds]}}
- Use findMatches utility to compute actual matches based on user preferences
- Maintain same return format {movieMatches: [], foodMatches: []} for UI compatibility

Fixes issue where getMatches function returned fixed data regardless of user responses.

Co-Authored-By: Dillon Vargo <dillonvargo@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify

netlify Bot commented Sep 11, 2025

Copy link
Copy Markdown

Deploy Preview for match-n-munch ready!

Name Link
🔨 Latest commit 514f2b5
🔍 Latest deploy log https://app.netlify.com/projects/match-n-munch/deploys/68c350db8f3ad800086bf9e4
😎 Deploy Preview https://deploy-preview-5--match-n-munch.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.

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.

1 participant