That's a good observation. I think I would agree with you. It should only be necessary to iterate through the -vote keys and count them up. I imagine the author does the aggregate state for simplicity. Since he does keep all the state, he could decide to check the aggregate every so often and see if it was still correct (and update it if not). The good news is that he hasn't lost any data, and could change his gadget to work without that state at any time.
I'll point that out in future talks. On Mon, Jan 18, 2010 at 7:53 AM, Tobias <[email protected]> wrote: > The sample gadget shown in this presentation [1], basically I think it > is this one [2], allows you to rate something (like it/dislike it). > It uses a key-value-pair to count the "likes", one pair to count the > "dislikes" and one pair for every user that voted > ("[email protected]": "like"). > > So when a user hits "Like it", it takes the current "like count", > increments the value and submits the new "like count" and the user key > ("[email protected]": "like"). > > And I think this could cause problems: > Imagine two users hit "Like it" at the same time. The current "like > count" is 4, so both users submit "5" as the new "like count". But by > doing so, one vote will be lost. > > Wouldn't it better to just count the user keys? > > > [1]: http://prezi.com/sxuwendhwqsy/ > [2]: http://wave-samples-gallery.appspot.com/about_app?app_id=46001 > > -- > You received this message because you are subscribed to the Google Groups > "Google Wave API" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-wave-api?hl=en. > > > >
-- You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.
