I do not know if this the right place to ask, but I do not know any other place I could go. I have a very big problem. I have used 100h to build up a meteor application for managing hockey tournaments that me and my friends are arranging. My application is 100% reactive with nice feature such as schedule with live clock, standings with all calculation, game rosters etc. I have done everything else, but my last thing would be to add statistics for the players, which I have not been able do in reactive way Our first tournament is in 2 days so I am really hopeless, because I am running out of time.
I have tried aggregate $out on server-side to write collection of players and their goals when match is changed to closed and bouncing this collection in helper, but this does not work in reactive way for some reason and helper wont get the updated data everytime even pushing the refresh button on browser.
I am hopeless, this was quite easy thing to do with my previous system which was built on LAMP, I just used Groups, Count, Join, Union and Derived.
player team G A P Crosby Sidney Pittsburg 1 1 2 Letang Kris Pittsburg 1 0 1 Granlund Mikael Minnesota 1 0 1 Koivu Mikko Minnesota 0 1 1 Haula Erik Minnesota 0 1 1
Server-side code is not reactive by definition. There are several ways around it. The way I solved it is by using excellent job-collection package, and creating a job to calculate metrics every time something changes. For example, I add a job to calculate “total items” on every insert and remove on Items collection, and so on. These jobs output their results to a separate Metrics collection, to which I can subscribe on the client and have near real-time data displayed.
@M4v3R Do the Meteor methods and publish/subcribe work when insecure is installed? I still have it. Job-collection looks promising, but I am not sure if I can accomplish to learn job-collection within one day. I am currently checking out if underscore can help. I think that underscore.js could do it on client-side as I will have no more than 70 objects (goals) to processed per tournament.
They should work just fine. All insecure does is executing Collection.allow on all your collections so you can modify data on the client without restrictions.
@M4v3R What do you think of processing this with Underscore.js? I think it would be okay to use Underscore.js to process about 70 objects on client-side? I just got into Underscore and I cannot figure out how to do it
70 objects should not be a problem for the client-side. What do “A” and “P” column mean in your desired output data? Also, how does player_name_event_second field get mapped to these?
@brajt Thx. Only problem is that my gf will destroy me anytime soon as I’ve been on computer doing this application since last friday Ultimate brainfog is a mild description under this pressure :–D
I have this (which is pretty horrible, due to the data structure) which works for the sample data above. It makes an events object which looks like this: