I am building a Laravel application where people upload videos of basketball games, and then stats are recorded. So, in the db, I've got a 'stat_metas' table where I store all the different types of basketball statistics (assists, 2 pointers made, etc). I also have a 'stats' table where I keep every recorded stat. Each record holds which "stat_meta" it was, which player did it, which game it happened in, etc.
Now, I am trying to display all of this data in a table, on both a per-game and per-team (teams have multiple games, so a per-team table would be all of the per-game data, aggregated) basis.
I also have some stats (like free throw percentage) that I had to calculate. I put each of those formulas in separate partial views and @included them (I now fear that was a bad idea, but you tell me).
Now, all of this 'worked' for both the calculated and added up stats, but then came time for me to add a totals row at the bottom of this table, and things got REAL messy, REAL quick, in part because I used the partial views I think.
Does anyone have any idea how I can make this work? Should I try using helper functions for each calculated stat?