SportsPress
SportsPress copied to clipboard
A different calculations on the career stats?
This is not a bug or a malfunction report. This is just a suggestion/solution for a case which could be probably limited to a niche but I had a request from my client and had to develop it on my own.
The request was that he wanted to enter in the event player performance box goals, yellow cards and etc not as numbers but as minutes when they scored since that is somehow a standardized way of displaying match statistics for players (at least as I was told to).
So for example, two goals were not set as 2, but as minutes such as 56',87' . For counting that I had to make that string into an array using comma (",") as delimiter and then the function count($array) would give me the number of goals.
I do not know if there were requests for that before but if there are many needs for that maybe that could be somehow implemented inside this plugin?
My solution (not final) would be that we can add another option/options to the Player Performance post type which would then define how its value is calculated. If integer, everything would remain the same, if has delimiter such as ",", then the value would be transformed into an array and the value would be the count of elements in the array.
In that way, the performance table in a single event page would not need to be changed, they would still show the value inserted, but the calculation on the career stats could even calculate values that are strings
@igorbenic thanks for your suggestion! Please consider adding it here so it can be voted by other users: http://tboy.co/ideas