robobruin / freebiestats

Automatically exported from code.google.com/p/freebiestats
0 stars 0 forks source link

Players with names like "J.D. Drew" do not work with the new HR/SB code #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Any time you have a batter whose "first name" is two initials, then the
getHRorSB() function doesn't work right, because it looks for the string
"JD Drew" in the HR and SB totals instead of "J Drew", which is how Yahoo!
displays them in those totals.

To fix this, just change the code:
var hitter = columns[0].childNodes[1].text.replace('.', '');

to:
var hitter = columns[0].childNodes[1].text.replace(/.\../, '');
hitter = hitter.replace('.', '');

Quick and simple fix to a relatively minor problem. (Unless you have Drew
on your team, of course!  Then it's a HUGE problem!)

Original issue reported on code.google.com by ethanher...@gmail.com on 14 Apr 2007 at 10:45

GoogleCodeExporter commented 9 years ago
definitely agree with the JD Drew comment...huge problem if you got him or Mark 
Prior
on your fantasy team.  my buddy Simon went into an autodraft and got both him 
and
Kerry Wood last year.

this regular expression should do it: text.replace(/(.).+ (.+)/,"$1 $2");
saves the first letter then removes everything until it sees a space, and then 
saves
the last name.

the problem with /.\../ is that it will remove J and then the . and then D, 
leaving
you with ". Drew"

Original comment by robobr...@gmail.com on 15 Apr 2007 at 5:04

GoogleCodeExporter commented 9 years ago

Original comment by robobr...@gmail.com on 15 Apr 2007 at 5:04

GoogleCodeExporter commented 9 years ago

Original comment by robobr...@gmail.com on 19 Apr 2007 at 6:01

GoogleCodeExporter commented 9 years ago

Original comment by robobr...@gmail.com on 4 May 2007 at 6:13

GoogleCodeExporter commented 9 years ago
this issue and issue #22
(http://code.google.com/p/freebiestats/issues/detail?id=22&can=1&q=) are 
related. 

Original comment by rod...@gmail.com on 28 Jun 2007 at 1:50