forked from frc1418/frc1418.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanner-locator.rb
More file actions
30 lines (29 loc) · 799 Bytes
/
banner-locator.rb
File metadata and controls
30 lines (29 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'tbarb'
require 'yaml'
require 'date'
TEAM = 1418
tba = TBA.new('AykWePEZPKTjZxW6y7MbiTEpTfUlWrszcX5QBpIDUEZPBCJydltvhfd88MsBXxdS')
year = DateTime.now.year
award_map = {}
(year - 1991).times do |count|
awards = tba.team_awards(TEAM, year)
award_list = []
awards.each do |award|
award_name = award['name'].split(' Award ')[0]
events = tba.team_events(TEAM, year, true)
event_name = ''
events.each do |event|
if event['key'] == award['event_key']
event_name = event['city']
end
end
if event_name == nil
event_name = ''
end
award_name = event_name + ' ' + award_name
award_list.push(award_name)
end
award_map[year] = award_list
year -= 1
end
File.open("_data/banners.yml", "w") { |file| file.write(award_map.to_yaml)}