Skip to content

Commit 7df16b3

Browse files
committed
fix smashalert
1 parent f16dceb commit 7df16b3

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@
3030
# Ignore master key for decrypting credentials and more.
3131
/config/master.key
3232
*.swp
33+
config/application.yml

app/providers/smash_gg/get_tournaments_by_country.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class SmashGg::GetTournamentsByCountry
2424
venueName
2525
events {
2626
videogame {
27+
id
2728
name
2829
}
2930
}
@@ -38,7 +39,7 @@ def self.call(country: "FR", page_size: 25)
3839
end
3940

4041
def self.videogames(hash)
41-
hash['events'].map{|e| e.dig('videogame', 'name')}.uniq
42+
hash['events'].select{|e| e.dig('videogame', 'id')}.map{|e| e.dig('videogame', 'name')}.uniq
4243
end
4344

4445
def self.format(results)

app/services/tournaments/check_new_tournaments.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def notify_discord(tournament)
3737
end
3838

3939
def notify_twitter(tournament)
40-
start_at = I18n.l(tournament[:start_at], format: :long)
40+
start_at = I18n.l(tournament[:start_at].in_time_zone, format: :long)
4141
tweet = "Un nouveau tournoi à #{tournament[:city]} sur #{tournament[:games].join(' et ')}\n#{tournament[:name]}\nDebute le #{start_at}\nhttps://smash.gg/#{tournament[:slug]}\nLieu: #{tournament[:venue_name]} #{tournament[:address]}"
4242
TwitterClient.update(tweet[0, 280])
4343
end

config/initializers/smashgg_graph_api.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
GHTTP = GraphQL::Client::HTTP.new("https://api.smash.gg/gql/alpha") do
55
def headers(context)
6-
{ "Authorization": "Bearer ef926a96a10fe53f24d940896357e7ac" }
6+
{ "Authorization": "Bearer #{ENV['SGG_API_TOKEN']}" }
77
end
88
end
99

0 commit comments

Comments
 (0)