PFObject once visited should not get retrieved again

I am using parse.com for my survey application, In that I am implementing like mechanism where I have set of two images which users will be able to see and they have to like one of them. which be part of my survey.

Now I am downloading 20 sets per query then asking user click More then i download next 20 sets n so on..

when I query all the 20 sets which user have already votes is getting downloaded again., so how do i stop that ? so I do not get those sets repeated again and again.

Answers


You should store your voting operations in somewhere.

So let me analyze the two possibilities to store your operations:

  • In your local (in the device): If you decide store them in local, you will retrieve some objects (sets) from the Parse and then you will look for unvoted ones, and probably you will lose some of them, maybe all of them. So it is not feasible.

  • In the Parse: As i explained, you should store them in Parse.

You can do it using:

  • Relations. You can take a look at:

    https://www.parse.com/docs/relations_guide#top

    When retrieving new sets, you should get sets which the current user hasn't voted yet. You can do this with Relational Queries in Parse. You can take a look at the documentation about it:

    https://www.parse.com/docs/ios_guide#queries-relational/iOS

  • Or creating a Join Table.

    This would be a custom implementation of a new class where you join your user with a set. Maybe you can store additional info about voting operations, like the time of voting.


Have a look at the Anypic tutorial on parse.com how they use the Activity class to track likes, comments etc. Use this as a template for how to plan your data model as opposed to relational principals.

One possible solution is to store all voted photos in an array on i.e. a voting object, or even the user object, and query for photos that are NOT in this array.


Need Your Help

Retrieve app data from Windows 8 Store

xml windows-8 wireshark

I'm trying to get a the app data for the applications currently available on Windows 8. I've used WireShark to monitor the network while accessing the store to no avail. I've managed to find the im...

Creating an interactive map for my website?

google-maps google-maps-api-3 maps interactive

I'd like to add an interactive map to my website, I will most likely be using the google maps API. My question: is it possible to have a user drop a pin on the map or enter an address and have that