My favorites | Sign in
Project Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 22: HR stat (occasionally) doesn't show for certain players
3 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----
Type-Defect
Priority-High


Sign in to add a comment
 
Reported by enthreeoh, Jun 20, 2007
I'm not sure if it's a bug with the script or a bug with the stats source,
but I've noticed at least 3 times now when Ken Griffey Jr. hits a HR, it
will show 1 R, 0 HR, 1 RBI in the stats. I've also noticed this happening
for another player but I can't recall who it was at the moment.

Could the parsing be off because of 3 words in his name? I'm not sure what
else it could be. Thanks for the great script, even if you're unable to
reproduce/fix this problem, it's still a great tool.
Comment 1 by rodric, Jun 20, 2007
problem reproduced. will look into it.
Status: Accepted
Labels: -Priority-Medium Priority-High
Comment 2 by enthreeoh, Jun 25, 2007
Also, in addition to HR not showing, SB appears not to show as well. Tested it with
Gary Matthews Jr.
Comment 3 by rodric, Jun 25, 2007
Thanks. It's the same issue: the same function parses the boxscores for SB, 2B, 3B,
HR, HBP, and SF. I'll try to fix it this week if I get a chance.


Comment 4 by gopack91, Aug 27, 2007
Also happens with B. McCann, since contains() is case sensitive, and Yahoo! likes to
spell his name as Mccann in the HR section.
Comment 5 by cbassin, May 20, 2008
Any fix for this?
Comment 6 by ethanherbertson, Apr 20, 2009
Still an issue for last names with multiple upper-case characters.  Sample code below
can be used as a player-specific workaround.

The second and third lines are the workaround; just replace McLouth and/or DeRosa
with the players on your team(s).  I'm not 100% sure SB are still a problem, but HR
definitely are.  This is obviously an unwieldy solution, but it works in the short term.

    function getXBHorSB(type, playerName, document) {
	if (type=='HR' && playerName=='N McLouth') {playerName='N Mclouth';}
	if (type=='HR' && playerName=='M DeRosa') {playerName='M Derosa';}
        var nodes = xpath(document, "//td[@class='yspscores' and contains(.,'" + type
+ "') and contains(.,'" + playerName + "')]");
        var j = nodes.snapshotLength;
        var numStat = 0;

        if (j) {
            var statLine = nodes.snapshotItem(j - 1).textContent;
            //Remove everything in parentheses since that may create false matches
            statLine = statLine.replace(/\([^\)].+?\)/gi,'');
            if (statLine.indexOf(playerName) > -1) {
                var re = new RegExp(".*(" + playerName + " *\\d?).+", 'gi');
                statLine = statLine.replace(re, "$1");
                statLine = statLine.replace(/[^\d]+/, '');
                numStat = (statLine == '') ? 1 : statLine;
            }
        }
        return numStat;
    }
Sign in to add a comment

Hosted by Google Code