Stat tracking ideas/etc...

Questions about modifications to Zuluru code, to add or change features
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Stat tracking ideas/etc...

Post by sulfur »

controllers/games_controller.php
~line 2358

Code: Select all

if (!League::hasSpirit($game['Division']['League'])) {
	$this->Session->setFlash(__('That league does not have stat tracking enabled!', true), 'default', array('class' => 'info'));
	$this->redirect('/');
}
"Stat" tracking there should likely be "Spirit" tracking, no? Also strikes me as odd that if you don't track spirit points, you can't track stats...

Related, yet unrelated, by the way things are currently set up, it seems that only coordinators and team captains can submit stats. I'm a bit surprised that someone who is an admin cannot submit stats (among other things, ie, designate jersey numbers on teams). One would assume that a site admin would (should?) have access to everything (ala "root" on a unix system).
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Stat tracking ideas/etc...

Post by GregS »

Whoops! That should be "League::hasStats", not "League::hasSpirit". Fix pushed to github.

On the other point, admins do generally have permission to do anything, but links might be missing. (This might be accidental or on purpose; in a couple of places I opted not to include links to certain things for admins, as it seemed like something they wouldn't generally be doing. But those decisions may not have been right...) Admins are never mentioned in the various isAuthorized functions, because those functions aren't even called for admins, they are given permission on everything. And anytime that is_volunteer is true, is_admin will also be true, so some places might only check the former but that implicitly also allows the latter. If you find anything where admins are explicitly excluded, or places where you think they should have a link but don't, let me know.
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Re: Stat tracking ideas/etc...

Post by sulfur »

Found a bug/problem in stat tracking for Goals Against Avg in soccer.

config/schema/data/stat_types_data.php, line ~3788

Code: Select all

                array(
                        'sport' => 'soccer',
                        'positions' => 'goalkeeper',
                        'name' => 'Goals Against',
                        'internal_name' => 'Goals Against',
                        'abbr' => 'GA',
                        'sort' => 440,
                        'class' => 'stat_games',
                        'type' => 'entered',
                        'validation' => 'team_score',
                ),
Validation should be 'opponent_score' not 'team_score' here.

Also, in the various sport components, the length of games is hard-coded. For example, in sport_hockey, it is '60', in sport_soccer it is '80' (note: a typical soccer game is 90 mins long). For these, it would seem to me that it would be better as a league "option" that can be set by league with a default setting for each sport. For example, a youth league may have 70 minute games, an indoor game might be 50 minutes long, and a men's game might be 90 minutes long.

Finally, to deal with three separate items in one, admins cannot submit stats for games, but can approve scorelines. It would seem (to me) that adding in the stats would also be appropriate (may be just me though!).
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Stat tracking ideas/etc...

Post by GregS »

Good catches. Stats have only really been used so far in Ultimate, so it's not surprising that there's a few things that have slipped through. I'll look at these in more depth this week. On the point about admins not being able to submit stats, are they actively restricted from doing so, or do they just not have links to do it?
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Re: Stat tracking ideas/etc...

Post by sulfur »

For admins -- no links. They can add stats (with the right manual links) without issue. I made some code changes to add in the ability, but when submitting stats for the games of the teams the admin belongs to, the URL has to have the "team:#" bit removed from the end to add details for both teams.

I've been putting together a new sport package (similar to soccer, but more than a bit different at the same time when it comes to statistics) and it seems that all of the stats (more or less) work. The only "gotcha" is the games played stuff, which only seems to populate when a statistic is entered. Once it's all done and settled, I'll submit the bits and pieces for you.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Stat tracking ideas/etc...

Post by GregS »

Yes, I'm pretty sure there's a comment in there somewhere (on the site, not in the code) about the requirement to enter a stat for someone to be recognized as having played the game. But I can't find it right now in a quick look. You can enter a 0 in any one column; this is recognized as distinct from all blanks when calculating games played. The other option I considered is to have a field just for that, but it seemed that adding this field would add more required input. And it would still have to check that you didn't enter any other stats for someone that was indicated as not playing the game. This may again be something that's more true of Ultimate than other sports, so definitely willing to entertain other ideas for how to deal with this.

Look forward to your submissions, and I promise I'll get on that other bug fix real soon!
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Stat tracking ideas/etc...

Post by GregS »

I believe that these have all been fixed now. Let me know if you still have problems with any of them.

The issue of making the game length configurable is a bigger task. The best option might be to use the game start and end times, as we have that information already. This would even allow it to handle games of different lengths within the same season. I've got this on the todo list, but it'll be a little while before I can address it.
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Re: Stat tracking ideas/etc...

Post by sulfur »

I'm not convinced that start/end times are the way to go, for some sports (ie Basketball, Hockey, indoor soccer, etc) often book timeslots that are a bit longer than the game and would likely use part of that time slot for changeover/etc.

I should have some time this weekend to look at this, since for our futsal league, we'll have slightly different game lengths based on age groups, so this is something that would be most useful for us! As such, I really don't mind putting some work into this to help others that might have similar requirements or desires.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Stat tracking ideas/etc...

Post by GregS »

Good point. I know that our local Ultimate club takes changeover into account with the time slots. For example, if we have a field from 7-10pm, the game slots will typically be 7-7:55, 8-8:55 and 9-9:55. But not everyone would do it that way, and I just now realized while typing this that any sport with a stop clock (e.g. hockey) would have time slots that are longer than the actual game time (e.g. hockey might have a 2 hour time slot for a 1 hour game plus stoppages plus intermissions). A per-division configuration (in the advanced settings, and defaulting to the expected time) does seem to be the way to go.
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Re: Stat tracking ideas/etc...

Post by sulfur »

I've been working on this stuff as mentioned, no huge advances yet, but I've got some solid ideas as to how to handle it.

Related to that, I'm also playing with a feature that allows "rating" information to be hidden (it's not applicable to our league, but may be to another league of the same sport), and also allows the ability to hide gender on single-sex divisions.

Unrelated to that... is there a way to see a player's statistical history with a team (ie, what games did the player score in, assist in, etc)? It strikes me that it would likely be an "easy" addition... maybe underneath the teams history or something on the player page?

Thoughts?
Post Reply