rocky-ravine-7055.herokuapp.com
-
Lack of a value in the XML file results in nil for that value (not 0).
-
Players can be on multiple teams in a given year. I stugggled with this one since it’s not clear to me that a player can be on multiple teams at the same time. On the other hand, there is no other personal information to disambiguate players across years, so I’m forced to assume surname and given name uniquly define a person (which we all know isn’t really true). Perhaps position could help, but that wouldn’t be reliable if players change positions over years or actually play multiple positions. My main point is that players can be on multiple teams in this demo and that this was on purpose.
-
Another implication of previous point is that stats are summed if a player is repeated in the XML.
-
en.wikipedia.org/wiki/Batting_average In baseball, the batting average (BA) is defined as the number of hits divided by at bats
-
Assuming hits means a single base
-
en.wikipedia.org/wiki/On-base_plus_slugging
H = Hits BB = Base on balls HBP = Times hit by pitch AB = At bats SF = Sacrifice flies TB = Total bases
In one equation, OPS can be represented as:
ops = (ab * (h + bb + hbp) + tb * (ab + bb + sf + hbp)) / (ab * (ab + bb + sf + hbp))
Translation:
ops = (at_bats * (hits + walks + hit_by_pitch) + total_bases * (at_bats + walks + sacrifice_flies + hit_by_pitch)) / (at_bats * (at_bats + walks + sacrifice_flies + hit_by_pitch))
-
en.wikipedia.org/wiki/Total_bases i.e., the sum of his hits weighted by 1 for a single, 2 for a double, 3 for a triple and 4 for a home run. Only bases attained from hits count toward this
total_bases = hits + 2 * doubles + 3 * triples + 4 * home_runs
-
See discussion above about disambiguating player names. We either need more identifying information for players or an understanding that player data should be denormalized so that year/player/stats are possibly in the same table. I prefer disambiguation.
-
All links in the navbar go nowhere.
-
bundle
-
rspec –color spec
-
Memcache for caching
-
Draper for presenters (i.e. making view clean)
-
Twitter bootstrap for styling
-
Rspec for unit testing
-
Mostly TDD.
-
Service objects used instead of concerns when not tied to Active Record
-
Concern used for search
-
Fairly strictly adhered to single responsibility principle
-
Red-green-refactor approach used
-
Attempt to keep methods small, understandable, and without comments. The code should be self-explanatory if not commented (in my opinion)
-
Underscore convention used to visually mark methods as private.
-
AJAX, coffeescript, and javascript used to load sorted table dynamically
-
Extra feature added allowing user to see all the stats for a user by clicking on their name
-
mouse-over floating-point values shows you the non-truncated value
-
Nokogiri/xpath harnessed to parse XML
-
Database normalization and associations added.
-
N+1 problems avoided on database layer by preloading associations.