forked from winsleague/winsleague
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/ingest 2016 nfl season (winsleague#193)
* added game hook for when games are removed * changed to look up team by mascot name because in nfl.com changed JAC to JAX and rams are now in LA. * variable rename for clarity * clearer logging * more efficient updating because we're isolating to league teams within the season * migration to add 2016 games. next time, include this in the original migration
- Loading branch information
Showing
6 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Migrations } from 'meteor/percolate:migrations'; | ||
import log from '../../imports/utils/log'; | ||
import NflGameData from '../../imports/api/games/server/nfl_game_data'; | ||
import LeagueFinder from '../../imports/api/leagues/finder'; | ||
import SeasonFinder from '../../imports/api/seasons/finder'; | ||
import { Games } from '../../imports/api/games/games'; | ||
|
||
Migrations.add({ | ||
version: 6, | ||
name: 'Adds 2016 games to NFL', | ||
up: () => { | ||
const season = SeasonFinder.getByYear('NFL', 2016); | ||
|
||
NflGameData.ingestSeasonData(season); | ||
}, | ||
down: () => { | ||
const league = LeagueFinder.getByName('NFL'); | ||
const season = SeasonFinder.getByYear('NFL', 2016); | ||
|
||
Games.remove({ leagueId: league._id, seasonId: season._id }); | ||
}, | ||
}); |