Author Topic: Stats Page - Looking for a Rolling Average?  (Read 998 times)

MikeS50

  • Newbie
  • *
  • Posts: 2
    • View Profile
Stats Page - Looking for a Rolling Average?
« on: June 01, 2020, 06:15:10 PM »
Hopefully this isn't a dumb question, but does anyone know if you can get a rolling average of a players last 'X' games?
Looking for something like sum(last(10, scores))

I've been browsing the forums and have only found Top finishes -
To count only the top 9, you'll need to set the Tournament Scoring formula to "points" and then set the Overall Formula to this:
sum(top(9, scores))

or Overall Average -
Set the Tournament Scores formula to rank and set the Overall Scores formula to:
average(scores)


Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Stats Page - Looking for a Rolling Average?
« Reply #1 on: June 05, 2020, 12:11:43 PM »
I think this would be a great thing to add.  But the difficulty is how the TD currently computes statistics.  It goes through a few phases:

- Look for all tournament files in the specified locations
- Filter out the tournaments that don't match the stats profile
- Go through the tournaments and get a list of all players
- Filter out the players that don't match the stats profile
- Go through all remaining tournaments and compute stats for each player in each tournament

By the time it gets to the last step where formulas are computed, we have a bunch of "player statistics" objects that contain all of the computed statistics.  This is used to compute the formula values.  To use your example:

sum(last(10, scores))

... at this point the scores variable is a list of the scores computed from the Tournament Scores formula.  But those scores are no longer associated with specific tournaments.  Functions like top(...) work fine because they only care about the score values themselves - they don't care which tournament they belong to.  That connection is gone.  But to implement something like last(...), we have to keep an association between the value and the tournament, so we can sort those values by tournament date.  It's not impossible, it's just not how the stats were designed.

tl;dr: you can't do it today, but could be a future enhancement.

MikeS50

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Stats Page - Looking for a Rolling Average?
« Reply #2 on: June 05, 2020, 08:41:43 PM »
Thanks for the reply Corey.
The best way I could come up with, so far, is to break my Seasons into whatever sample size I was looking for (say 10 tournaments), then only show the stats for that shortened Season.  If I wanted to include a 'yearly' stat then I would include whichever Seasons were played in that year.  It's a manual solution, but it might work. 

I run a small home game of 12-16 people, so my ultimate goal in this was to see who was 'hot' recently and then potentially assign a bounty for knocking that person out.  Just to spice things up a bit!

Thanks for all your help.


Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6216
    • View Profile
Re: Stats Page - Looking for a Rolling Average?
« Reply #3 on: June 06, 2020, 10:43:07 AM »
And this will likely work for a small group.  Where it breaks, I think, is when people miss tournaments.  If you have a 10 tournament season but want to see a rolling average for the last 5 tournaments, you setup the filter by date to include the last 5 tournaments, but not everyone participated in all 5 as they may have missed a tourney.  What you want to happen is the averaging of the last 5 tournaments each player participated in, which when players miss tournaments ends up being a different set of tournaments for each player.  That's the part the TD can't do currently.