Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2017 sql schedule going to be ready this year? #37

Open
savagegeek opened this issue Aug 10, 2017 · 7 comments
Open

2017 sql schedule going to be ready this year? #37

savagegeek opened this issue Aug 10, 2017 · 7 comments

Comments

@savagegeek
Copy link

Was just wondering if the 2017 sql file will be ready this year, or should we just create our own by hand based on the 17 week schedule? I did a donation :-)

@elwerto
Copy link

elwerto commented Aug 15, 2017

Hi, 3rd. Year as a happy and thankful user of your code with every year donation as well.
I guess the change this year will be beyond the "docs" folder, because of the changes in the location of some teams. Will it be?

@bwdgraphics
Copy link

May not be the best way to do this, but, after updating San Diego (SD -> LAC) and Rams (LA -> LAR) and making some other code and image (name) changes ... this is the SQL version of the 2017 schedule. (Again, you'll have to make the other changes, too, but this will work after that.)

nflp_schedule_2017.sql.zip

@savagegeek
Copy link
Author

Thanks very much. I'm all set.

@xSirThomasx
Copy link

Quick question. @bwdgraphics
For autoloading scores, do we have to edit getHtmlScores.php?
<?php require('includes/application_top.php'); $week = (int)$_GET['week']; //load source code, depending on the current week, of the website into a variable as a string $url = "http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=2"; if ($xmlData = file_get_contents($url)) { $xml = simplexml_load_string($xmlData); $json = json_encode($xml); $games = json_decode($json, true); } //build scores array, to group teams and scores together in games $scores = array(); foreach ($games['gms']['gd'] as $gameArray) { $game = $gameArray['@attributes']; if ($game['q'] == 'F' || $game['q'] == 'FO') { $overtime = (($game['q'] == 'FO') ? 1 : 0); $away_team = $game['v']; $home_team = $game['h']; $away_score = (int)$game['vs']; $home_score = (int)$game['hs']; $winner = ($away_score > $home_score) ? $away_team : $home_team; $gameID = getGameIDByTeamID($week, $home_team); if (is_numeric(strip_tags($home_score)) && is_numeric(strip_tags($away_score))) { if ($away_score > 0 || $home_score > 0) { $scores[] = array( 'gameID' => $gameID, 'awayteam' => $away_team, 'visitorScore' => $away_score, 'hometeam' => $home_team, 'homeScore' => $home_score, 'overtime' => $overtime, 'winner' => $winner ); } } } } //see how the scores array looks echo '<pre>' . print_r($scores, true) . '</pre>'; echo json_encode($scores); //game results and winning teams can now be accessed from the scores array //e.g. $scores[0]['awayteam'] contains the name of the away team (['awayteam'] part) from the first game on the page ([0] part)

On this line
$url = "http://www.nfl.com/ajax/scorestrip?season=2016&seasonType=REG&week=2";
The default is set to "week=2:". Im not sure what's going on there, but Im assuming
changing that line to...
$url = "http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week=2";
...should work, right?
I hit that page, and it is indeed the schedule and scores for this year, but Im just worried and curious as to why the week is set to "2".
I mean, thats what its set to originally, so it should be fine.

@bwdgraphics
Copy link

I think that might be an error. I am actually using old code that I update each year, so mine does not have the week=2 part. It's just: $url = "http://www.nfl.com/ajax/scorestrip?season=".SEASON_YEAR."&seasonType=REG&week=".$week;

It's quite possible that I noticed that at some point and changed it - but I have not kept any sort of records really for this code as it's just for fun. The above usually works for me. (It used to reference ESPN scores which were available anytime/always - NFL.com scores load well after the game is finished on occasion.)

@randyr505
Copy link

xSirThomasx, see the pull request link below for comments on how others have done this. I used most of numericOverflow's code in my fork. My fork also adds the option of hiding a users picks via a config option and tracking tiebreaker points.

#19

@xSirThomasx
Copy link

Everything is fine. I changed the year to 2017 and left the rest as I found it.
Im using an altered version of the game, that I put together:
Users pick a team each week, whatever points their team scores goes into their total score, and users can only pick a team once per season. This is an irrelevant bit of information, but just figured Id clarify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants