fliptables / bcjs

0 stars 0 forks source link

Average Shape Objects #5

Closed getnashty closed 9 years ago

getnashty commented 9 years ago

For pages like this: http://staging.croovies.com/people/27

We'll need an "avg" shape item... IE, a list of ID's returns an average shape of the ratings of those IDs.

This element cannot be manipulated by the user.

I'm thinking about two different ways of managing this - either the publisher has hooks into BC (so on croovies backend, we can created new "avg" objects by supply a bunch of ID, and BC returns an "avgItemID"... Then we use that id in the BCJS element...

Or, the element itself accepts an array of ID, and returns the avg on the fly... While this seems easier for the publishers, it seems more calculation intensive/expensive for BC...

Thoughts?

treasonx commented 9 years ago

We can request the list of ids from the BC backend and calculate the average of those in JS.

getnashty commented 9 years ago

why calculate in JS, rather than just sending back the calculated avg?

treasonx commented 9 years ago

Couple Reasons

  1. Same BC API no additional functions or things to maintain.
  2. User's CPU is free :)
  3. caching, we can just display the rating if we want without another request.
getnashty commented 9 years ago

Will it affect speed for the calculation to be done on the user's machine, rather than stored on BC and incrementally updated?

treasonx commented 9 years ago

No calculating an average is nothing. Unless you have millions of objects then maybe we need OLOO