Played matches statistics bug?

Status: finished.
Here you can find pre-releases of JoomLeague, Errors and problems with these versions should only be discussed in this board.
NOTICE: BETA and RC versions should not be used on a live site! No support on upgrading to the final version!

Moderator: And_One

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Played matches statistics bug?

Postby zeta65 » Mon Dec 27, 2010 10:36 pm

Can someone confirm that inside the roster view sum of played matches by a single player is wrong?
I mean that sum between presences in starting roster an come in isn't right.
For example if a player entered in 5 matches, only one of them is counted.
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)

User avatar
timoline
Joomleague Core Developer, Donator
Joomleague Core Developer, Donator
Posts: 3331
Joined: Thu Mar 12, 2009 8:03 am
Contact:

Re: Played matches statistics bug?

Postby timoline » Mon Dec 27, 2010 10:40 pm

do you have a screenshot?
http://www.joomleague.at/en/demo/team/roster

looks ok

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Re: Played matches statistics bug?

Postby zeta65 » Mon Dec 27, 2010 10:56 pm

timoline wrote:do you have a screenshot?
http://www.joomleague.at/en/demo/team/roster

looks ok

mmmh Rasmus Lindgren doesn't seem to be ok.
29. November 1984 (26) 3 2 3

should be

29. November 1984 (26) 5 2 3
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)

User avatar
timoline
Joomleague Core Developer, Donator
Joomleague Core Developer, Donator
Posts: 3331
Joined: Thu Mar 12, 2009 8:03 am
Contact:

Re: Played matches statistics bug?

Postby timoline » Mon Dec 27, 2010 11:13 pm

zeta65 wrote:
timoline wrote:do you have a screenshot?
http://www.joomleague.at/en/demo/team/roster

looks ok

mmmh Rasmus Lindgren doesn't seem to be ok.
29. November 1984 (26) 3 2 3

should be

29. November 1984 (26) 5 2 3


yes I see whatyou mean :)

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Re: Played matches statistics bug?

Postby zeta65 » Wed Dec 29, 2010 10:53 pm

found and (I hope) fixed this bug. :)
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)

And_One
Joomleague Project Manager, Donator
Joomleague Project Manager, Donator
Posts: 3613
Joined: Fri Sep 11, 2009 4:00 pm
Joomleague version: 2.0.x
Location: Graz
Contact:

Re: Played matches statistics bug?

Postby And_One » Thu Dec 30, 2010 2:12 am

http://bugtracker.joomleague.at/redmine/issues/575

i think that the column played should show a summary of all matches where the player has "played". lets give an example with fantasy amounts:

a player was 30 times in the starting roster = 30
a player was substituted 100x in 2 other matches = counts as 2 and not 100, because 2 coz he played in match a and match b, sure he was substituted alot, lets say 50 times in match a and 50 times in match b. i would say hw played in match a = 1 + 1 match b = 2. so just for me this counts as 1 for match a and 1 for match b. and not a formula like: played = amount of all substitutions + amount of matches where he was in the startroster. there is one thing to consider, the case where a player was not in the startroster but later substituted (maybe one or more times). this still have to count as 1.

so my calculation formula was:

[syntax="sql"]
sum(IF(mp.came_in=0,1,0)) + max(IF(mp.came_in=1,1,0)) AS played,
sum(IF(mp.came_in=0,1,0)) AS started,
sum(IF(mp.came_in=1,1,0)) AS sub_in,
sum(IF(mp.out=1,1,0)) AS sub_out
[/syntax]

short explanation how the values are stored:

everytime a player is in the start roster: came_in=0
everytime a player is substituted: came_in=1

yes i have to mention, there is maybe a problem with existing data. i just tested it with a new match an new substitutions and not with old existing data. maybe i have overlooked something,... lets discuss it.

User avatar
timoline
Joomleague Core Developer, Donator
Joomleague Core Developer, Donator
Posts: 3331
Joined: Thu Mar 12, 2009 8:03 am
Contact:

Re: Played matches statistics bug?

Postby timoline » Thu Dec 30, 2010 8:05 am

IMHO
Played is when a player is in the startroster OR substitute(comes in) later in a match.
(Doesnt matter how many times the player comes in or out in the same match, he just played 1)

And_One
Joomleague Project Manager, Donator
Joomleague Project Manager, Donator
Posts: 3613
Joined: Fri Sep 11, 2009 4:00 pm
Joomleague version: 2.0.x
Location: Graz
Contact:

Re: Played matches statistics bug?

Postby And_One » Thu Dec 30, 2010 9:55 am

timoline wrote:IMHO
Played is when a player is in the startroster OR substitute(comes in) later in a match.
(Doesnt matter how many times the player comes in or out in the same match, he just played 1)


thats waht i try to say, and for this reason max() and not sum() ;)

User avatar
timoline
Joomleague Core Developer, Donator
Joomleague Core Developer, Donator
Posts: 3331
Joined: Thu Mar 12, 2009 8:03 am
Contact:

Re: Played matches statistics bug?

Postby timoline » Thu Dec 30, 2010 9:58 am

hmm, well

then again Zeta's example

mmmh Rasmus Lindgren doesn't seem to be ok.
29. November 1984 (26) 3 2 3

should be

29. November 1984 (26) 5 2 3

And_One
Joomleague Project Manager, Donator
Joomleague Project Manager, Donator
Posts: 3613
Joined: Fri Sep 11, 2009 4:00 pm
Joomleague version: 2.0.x
Location: Graz
Contact:

Re: Played matches statistics bug?

Postby And_One » Thu Dec 30, 2010 10:05 am

timoline wrote:hmm, well

then again Zeta's example

mmmh Rasmus Lindgren doesn't seem to be ok.
29. November 1984 (26) 3 2 3

should be

29. November 1984 (26) 5 2 3


i will check the old demo data

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Re: Played matches statistics bug?

Postby zeta65 » Thu Dec 30, 2010 11:56 am

And_One wrote:yes i have to mention, there is maybe a problem with existing data. i just tested it with a new match an new substitutions and not with old existing data. maybe i have overlooked something,... lets discuss it.


Well, I had problems with subs also with new data, not only with old subs.
I understand the problem you want to solve about countig only one time different subs in same match, but it
seems that with your query (with max and not sum) also subs of two different matches are counted only one and this isn't right.
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Re: Played matches statistics bug?

Postby zeta65 » Thu Dec 30, 2010 12:29 pm

Moreover I'm a little bit confused about that query. Why do we have to Inner join all that tables?
match_player, project_team, and team_player wouldn't be enought to check subs and played?
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)

And_One
Joomleague Project Manager, Donator
Joomleague Project Manager, Donator
Posts: 3613
Joined: Fri Sep 11, 2009 4:00 pm
Joomleague version: 2.0.x
Location: Graz
Contact:

Re: Played matches statistics bug?

Postby And_One » Thu Dec 30, 2010 12:38 pm

which file, which query, which function do you mean?

User avatar
zeta65
.
Posts: 965
Joined: Fri Aug 10, 2007 4:40 pm
Location: Italia
Contact:

Re: Played matches statistics bug?

Postby zeta65 » Thu Dec 30, 2010 1:30 pm

And_One wrote:which file, which query, which function do you mean?

Do you think I was a little bit cryptic? >:D ;)

Aren't we talking about the roster view and about presences stats?
The file is model/roster.php, here the function with the discussed query:

function _getTeamInOutStats()
{
$projectteam=&$this->getprojectteam();
if (empty($this->_teaminout))
{
$query=' SELECT sum(IF(mp.came_in=0,1,0)) + sum(IF(mp.came_in=1,1,0)) AS played,
sum(IF(mp.came_in=0,1,0)) AS started,
sum(IF(mp.came_in=1,1,0)) AS sub_in,
sum(IF(mp.out=1,1,0)) AS sub_out,
tp.id, tp.person_id
FROM #__joomleague_match AS m
INNER JOIN #__joomleague_match_player AS mp ON mp.match_id=m.id
INNER JOIN #__joomleague_round r ON m.round_id=r.id
INNER JOIN #__joomleague_project_team AS pt1 ON m.projectteam1_id=pt1.id
INNER JOIN #__joomleague_team_player AS tp ON tp.id=mp.teamplayer_id
INNER JOIN #__joomleague_team AS t1 ON t1.id=pt1.team_id
INNER JOIN #__joomleague_project_team AS pt2 ON m.projectteam2_id=pt2.id
INNER JOIN #__joomleague_team AS t2 ON t2.id=pt2.team_id
INNER JOIN #__joomleague_project AS p ON p.id=r.project_id
WHERE tp.projectteam_id='.$this->_db->Quote($projectteam->id)
'
AND m.published = 1
AND p.published = 1
AND tp.published = 1
GROUP BY tp.person_id
';

$this->_db->setQuery($query);
$this->_teaminout=$this->_db->loadObjectList('person_id');
}
return $this->_teaminout;
}

I think that this query must be revisited, cause with my change it doesn't count rightly presences in case multiple subs in same game, and without my change it doesn't count presences rightly in all cases.

Now I understand that you innerjoin some tables to check if they are published, but what about round table?

Here is zeta, hoping having been more clear and wishing you a good new year (with joomleague 1.5 released)! :p
website: www.uscosio.org
joomla vers.: Joomla 1.5.x
joomleague vers.:Joomleague 1.5 (latest git build)


Return to “1.5.0-a (Alpha)”

Who is online

Users browsing this forum: No registered users and 2 guests