Browse Source

Delete 'test-stats.rb'

master
simulacrumparty 3 years ago
parent
commit
37cd021195
1 changed files with 0 additions and 42 deletions
  1. 0
    42
      test-stats.rb

+ 0
- 42
test-stats.rb View File

@@ -1,42 +0,0 @@
1
-# This script pulls offensive/defensive ratings stats from stats.nba.com and
2
-# our app (production by default, or qa if invoked with
3
-# `ruby test-stats.rb qa`) and compares them, noting any differences.
4
-
5
-require 'json'
6
-require 'net/http'
7
-
8
-env = ARGV.first ? "-#{ARGV.first}" : ""
9
-
10
-stats_url = URI('https://stats.nba.com/partnerutilities/leagueteamstats?Conference=&DateFrom=&DateTo=&Division=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2019-20&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&TwoWay=0&VsConference=&VsDivision')
11
-game_url = URI("https://picks#{env}.nba.com/api/static-v1/nbapicksix/game.json")
12
-
13
-stats = JSON.parse(Net::HTTP.get_response(stats_url).body)
14
-game = JSON.parse(Net::HTTP.get_response(game_url).body)
15
-
16
-all_match = true
17
-
18
-stats["resultSets"][0]["rowSet"].each do |stats_record|
19
-  left = {
20
-    offrtg: stats_record[8],
21
-    defrtg: stats_record[10],
22
-    offrtg_rank: stats_record[32],
23
-    defrtg_rank: stats_record[33]
24
-  }
25
-
26
-  game_record = game['teams'].find { |team| "#{team['place_name']} #{team['team_name']}" == stats_record[1] }
27
-  right = {
28
-    offrtg: game_record['offensive_rating']['value'].to_f,
29
-    defrtg: game_record['defensive_rating']['value'].to_f,
30
-    offrtg_rank: game_record['offensive_rating']['rank'],
31
-    defrtg_rank: game_record['defensive_rating']['rank']
32
-  }
33
-
34
-  unless left == right
35
-    all_match = false
36
-    puts game_record["team_name"]
37
-    puts "  NBA\n    " + left.inspect
38
-    puts "  Us\n    " + right.inspect
39
-  end
40
-end
41
-
42
-puts "All good" if all_match

Loading…
Cancel
Save