Skip to content

Commit 87d3b67

Browse files
committed
Show debug prints in each request to fetch
1 parent 0fbfbcc commit 87d3b67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

get_data_from_earth.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
first: 400,
7474
filterBy: {
7575
countryCode: "JP",
76-
verified: true
76+
#verified: true # This does NOT change on number_of_dojos
7777
}
7878
) {
7979
nodes {
@@ -121,11 +121,11 @@ def request_data(query:, variables:)
121121
dojo_data = []
122122
unique_ids = Set.new
123123
page_number = 0
124-
print 'Fetching page by page: '
125124

126125
# Fetch clubs for Japan without filtering by brand
127126
variables = { after: nil }
128127
query = JP_DOJOS_QUERY
128+
print ' JP_DOJOS_QUERY: '
129129
begin
130130
print "#{page_number = page_number.succ}.."
131131
fetched_data = request_data(query: query, variables: variables)
@@ -138,10 +138,12 @@ def request_data(query:, variables:)
138138
page_info = fetched_data[:pageInfo]
139139
variables[:after] = page_info[:endCursor]
140140
end while page_info[:hasNextPage]
141+
puts " (JP: #{dojo_data.count})"
141142

142143
# Fetch clubs for other countries with filtering by brand
143144
variables = { after: nil }
144145
query = ALL_DOJOS_QUERY
146+
print 'ALL_DOJOS_QUERY: '
145147
begin
146148
print "#{page_number = page_number.succ}.."
147149
fetched_data = request_data(query: query, variables: variables)
@@ -154,6 +156,7 @@ def request_data(query:, variables:)
154156
page_info = fetched_data[:pageInfo]
155157
variables[:after] = page_info[:endCursor]
156158
end while page_info[:hasNextPage]
159+
puts " (Total: #{dojo_data.count})"
157160

158161
File.write('tmp/number_of_dojos', dojo_data.length)
159162
File.open('dojos_earth.json', 'w') do |file|

0 commit comments

Comments
 (0)