I’ve just finished reading Josh Owens blog about collection helpers and it got me thinking.
I’m in the process of designing my model for a quoting system. I’ve been wrestling with various ideas of how to deal with displaying the total of the quote. The quotes are likely to be very complex so I was looking at calculating the totals and margins whenever the quote items were modified and storing them in the quote document, using a combination of collection-hooks and autoValues.
This would mean the calculations were done by the server once for each quote, but often while the quote is being modified. The idea of attaching a helper to the quote collection that would return the results of the calculation was dismissed initially as I was reading this, because it would require the calculation to be run every time a user requested that total value. (A list of 100 quotes would contain a total for each quote for example). However, it then occurred to me that as all this data is available to the client anyway, it would be the client browser running these calculations and not the server anyway would it not?
I wonder whether this more distributed way might be more efficient overall. Has anyone with a bit more experience in Meteor than me got any thoughts on this?
I hope I’ve explained myself well enough.