Skip to content

Commit

Permalink
Updated PlayerExtractor method GetCurrentClubName() - do not assume that
Browse files Browse the repository at this point in the history
the current club is first in the list, use the leftDate to identify instead.
  • Loading branch information
MikeHook committed May 2, 2011
1 parent 0c2296a commit 4c50fe9
Show file tree
Hide file tree
Showing 2 changed files with 739 additions and 6 deletions.
9 changes: 3 additions & 6 deletions CSharpApp/FootyLinks.Processes/PlayerExtractor.cs
Expand Up @@ -84,13 +84,10 @@ public string GetCurrentClubName()
if (_playerClubs.Any() == false)
return null;

PlayerClubDto mostRecentClub = _playerClubs.First();
PlayerClubDto mostRecentClub = _playerClubs
.SingleOrDefault(c => c.PlayerLeftDate.HasValue == false);

//There is a leaving date for their most recent club so they must be retired
if (mostRecentClub.PlayerLeftDate != null)
return null;

return mostRecentClub.ClubName;
return mostRecentClub != null ? mostRecentClub.ClubName : null;
}

public IList<string> GetFormerClubs()
Expand Down

0 comments on commit 4c50fe9

Please sign in to comment.