Filter Deck Swiper to remove Cards seen before

Objective: Filter the Deck Swiper so that it doesn’t show Cards which the user has seen before

I have the following collections:

  1. Users
  2. Questions
  3. QuestionPhotos
  4. Results

NB: I have a Questions and Questions Photos table because each questions can have multiple photos but the deck swiper needs a single column to source images.

My approach so far is that every time a user swipes I’ll create a row in the Results collection containing the QuestionPhoto and the User. Then I should be able to filter the Card Deck to show cards which this user hasn’t swiped on.

I have setup a filter so that the card deck doesn’t show any questions created by the logged in user, which works fine.

However, I cannot get the card deck to filter out QuestionPhotos which the user has already seen and swiped on. Please see screenshots. There is data in the Results collection for the logged in user but when the filter is set to “Does not contain” it still shows the QuestionPhotos regardless. If the filter is set to “Contains”, it doesn’t show anything regardless of user.

So I suspect my setup is incorrect somewhere - either in the filter or the Collection relationships - but I can’t find any documentation on filtering using “All” or “Count” although I’ve spent hours trying to solve this.

Please help!

A more detailed view:

Relationships:

How are the relationships setup between the collections? One to many? Many to many?

@greg_noobdiscs thanks for the response

A result can only have one user but a user can have many results

A result can only have PhotoQuestion but a PhotoQuestion can have many results.

So I’ve set them both up as one to many.

A PhotoQuestion can only have one question but many PhotoQuestions per Question. So when filtering the card deck (a list of PhotoQuestions) it’s easy to filter by question and this is how I’m removing questions from the card deck created by the logged in user.

However, the problem or misunderstanding for me here is that because there can be many Results for this PhotoQuestion it gives me different filtering options “all” or “count” as per the above.

I don’t know if it’s the relationships which are wrong or the filter expression but I’ve tried every possible combination.

I even changed the relationship between Result and PhotoQuestion so that I could match the user in Result to the logged in user i.e. This user has voted on this card before so don’t show it. But that then causes a problem when creating the Result data entry as it’s unable to set this value.

Please also see icons in last screenshot in case I’ve got this wrong.

Please can you explain what I’ve done wrong so I can apply this to other scenarios? Thanks

Hi @ChrisAndo88,

Short answer - I suggest to create a new property in a PhotoQuestion collection. Call it, say, SeenBy. This is “Many to Many” property - link it to users’ collection.
As a result, some user can have many SeenBy PhotoQuestions, and one PhotoQuestions can have many SeenBy users.

Then you add a filter for DeckSwiper. Custom filter:
Current PhotoQuestion -> SeenBy -> All (you select all)
Does not contain
Logged-in User.

This should work. The downside here is that such filtering seems to be quite slow. I’ve seen some glitches - sometimes the already seen image was displaying, and then disappearing in a second.

1 Like

@Victor You are a genuis! Thank you so much. I’ve spent a LOT of time trying to figure this out so thanks again for your help. I’ll post here when I get into some volumes and advise if it’s causing a problem.

1 Like

@ChrisAndo88 happy to help :slight_smile:

1 Like

Was going to say the same thing as @Victor. Just kidding. Glad it got resolved. I was probably going to run into the same thing as some point. Would love to see it in action when it’s implemented!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.