Merry3750 / scorigami

This project is dedicated to tracking all scorigami throughout history and keeping the scorigami chart up to date at all times.
http://NFLScorigami.com
MIT License
54 stars 19 forks source link

Preseason Games are not Counted #6

Closed ghost closed 6 years ago

ghost commented 6 years ago

I checked if preseason games show up in the scorigami app, they appear not to. For example, on 3 August 2017, the Dallas Cowboys won versus the Arizona Cardinals 20-18; however the app says that the last time an 20-18 score happened was 23 January 2016 when the Denver Broncos won vs the New England Patriots (crazy right?) 20-18.

I bring this up since the Denver Broncos won vs the Arizona Cardinals 30-2 in the 2017 preseason, and I did not see the 30-2 box lit up. If it is possible to fix this, please do! Thanks!

Merry3750 commented 6 years ago

This is intentional. Only Regular and Post season games are counted since preseason games are more-or-less meaningless.

ghost commented 6 years ago

Oh. Well I still thought you could at least add a "preseason mode" or something to toggle them. Preseason games don't really matter but scorigami can still happen in them. Thanks for responding so quickly!

ghost commented 6 years ago

If for example the absurd defensive 1-pt safety were to happen in a preseason game, it's hard not to take note of it.

Merry3750 commented 6 years ago

It is certainly possible, but it would require a sizable overhaul of the system I have set up, plus I wouldn't be able to accurately test it until the actual preseason. Neither of these things completely disqualify the idea, but they do demotivate me. However I can only find preseason records dating back to 1983, so even if I were to implement it, it would never be accurate, which does disqualify it in my eyes.

ghost commented 6 years ago

Well that's unfortunate. I'd be OK with it only doing preseason games since when you can get records of them, but could you please let me know where you got those preseason scores? I might be able to write a script myself to get the data or put it in Google Sheets for easy access or something. Thanks for letting me know!

Merry3750 commented 6 years ago

https://www.pro-football-reference.com/years/2017/preseason.htm

change 2017 to whatever year, all the way down to 1983

ghost commented 6 years ago

OK, thanks.

ghost commented 6 years ago

I dug through the code and saw that the updateData() function ignores preseason games; you could store the seasonType directly into the data file and use a toggle on the page to enable/disable them. I would test this myself but I don't know how to go about importing old preseason game data (like the 30-2 game). The only thing I think would be difficult is importing the old data-- as far as I know if you import preseason games from 2018 onwards you won't have to change your system very much if at all. At the moment I'm writing a script to download all of the preseason scores since 1983 and converting them to the format used in https://feeds.nfl.com/feeds-rs/scores.json.

Merry3750 commented 6 years ago

It's not quite that simple. You would have to store all of the relevant data to fill out the info box, effectively almost doubling the data you have to maintain

ghost commented 6 years ago

If you're using the "gameDate": "9/9/1999" thing in the JSON for the date, I've got that covered, and I'm getting as much information as I can. I've gotten the score, date, and teams involved from pro-football-reference; if there's any more data I need let me know. Also, I'm getting all the data from 1983 till now, but since the NFL's feed thing does preseason games as also I think it'll work with those too. I'm just getting old games now.

ghost commented 6 years ago

I got it to work and this is a sample output:

        {
            "gameSchedule": {
                "season": 1983
                "seasonType": "PRE",
                "week": 4
                "gameDate": "8/31/1983"
                "homeDisplayName": "Arizona Cardinals"
                "visitorDisplayName": "*Denver Broncos*"
            }
        }

If you need more info let me know.

Merry3750 commented 6 years ago

You also need the scores

ghost commented 6 years ago

Oh yeah stupid me

ghost commented 6 years ago

Here's one that has the scores this time around. I couldn't get quarter by quarter info but that shouldn't matter, right?

      {
            "gameSchedule": {
                "season": 2017
                "seasonType": "PRE",
                "week": 4
                "gameDate": "8/31/2017"
                "homeDisplayName": "Arizona Cardinals"
                "visitorDisplayName": "*Denver Broncos*"
                "visitorTeamScore": {
                    "pointTotal": 2
                }
                "homeTeamScore": {
                    "pointTotal": 30
                }
            }
        }
Merry3750 commented 6 years ago

No, the database doesn't care what the score at any point in the game but the end.

ghost commented 6 years ago

All right so here's the file of every preseason game ending since 1983:

ghost commented 6 years ago

I pressed the wrong button to close this. Anyway, here's that file: dump.json.txt

Merry3750 commented 6 years ago

Nice! You'll have to mess with the parser a bit to force things through, but that's all of the data you'll need to track

ghost commented 6 years ago

All right cool! Those are all of the old ones from 1983-2017 which I imagine isn't too difficult to import into your database. When it comes to the 2018+ preseason games, AFAIK the data from NFL's feeds is the same; you just need to remove this if statement (line 67 in server.js):

if (data.seasonType === "REG" || data.seasonType === "POST")

and it'll record future preseason games.

Merry3750 commented 6 years ago

More or less, yeah. If you intend to keep preseason as an option instead of the default, you'll have to add checks later on to keep preseason separate.

ghost commented 6 years ago

All right, cool. I looked through the code and made it so that there is a "score" element so it can be parsed with the same parser:

        {
            "gameSchedule": {
                "season": 1985
                "seasonType": "PRE",
                "week": 2
                "gameDate": "8/11/1985"
                "homeDisplayName": "*Kansas City Chiefs*"
                "visitorDisplayName": "Cincinnati Bengals"
                "score": {
                    "visitorTeamScore": {
                        "pointTotal": 35
                    }
                    "homeTeamScore": {
                        "pointTotal": 27
                    }
                }
            }
        }

P.S. I noticed in the code the variable "aCompleteF***ingMiracleHasHapppened"

ghost commented 6 years ago

The only big-ish problem is the "gameLink" since these preseason games... don't have links.

Merry3750 commented 6 years ago

You could just have it link to the list of preseason games where you got the data from originally

aCompleteFuckingMiracleHasHappened is a case that will likely never be true (hence the name), but has actually proven to be very useful in testing since it allows me to just dump a bunch of fake scores on some point in the chart and it handles them beautifully

ghost commented 6 years ago

Good idea for the link, might be a bit awkward though with the "see all 7 games" or whatever link. And I see what aCompleteFuckingMiracleHasHapppened is for now. (and yes in the source code there are 3 p's in Happpened)

Merry3750 commented 6 years ago

No it doesn't

ghost commented 6 years ago

Oh. Well the newest commit is "fixed spelling error in variable" so... Anyway, I chunked the preseason games from each week (1-5) together as they are in the feed; now the file looks like this: dump.json

ghost commented 6 years ago

Here's a fixed file (some minor errors): dump.json

ghost commented 6 years ago

To add to this, is the Pro Bowl counted (as it is soon)? Generally it's pretty high scoring, and might go deeper into the "scoring arctic" where both teams score a ton.

Merry3750 commented 6 years ago

It isn't. I am not tracking any exhibition games.

ghost commented 6 years ago

OK.