fix scale reference
This commit is contained in:
@@ -12,7 +12,6 @@ class PopularSearchService
|
|||||||
end
|
end
|
||||||
|
|
||||||
@date = date
|
@date = date
|
||||||
@scale = "day"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def each_search(limit = 100, &block)
|
def each_search(limit = 100, &block)
|
||||||
@@ -26,8 +25,8 @@ class PopularSearchService
|
|||||||
def fetch_data
|
def fetch_data
|
||||||
dates = date.strftime("%Y-%m-%d")
|
dates = date.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
Cache.get("ps-#{scale}-#{dates}", 1.minute) do
|
Cache.get("ps-day-#{dates}", 1.minute) do
|
||||||
url = "#{Danbooru.config.reportbooru_server}/hits/#{scale}?date=#{dates}"
|
url = "#{Danbooru.config.reportbooru_server}/hits/day?date=#{dates}"
|
||||||
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 3))
|
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 3))
|
||||||
if response.success?
|
if response.success?
|
||||||
response = response.body
|
response = response.body
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class PostViewCountService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fetch_count(post_id)
|
def fetch_count(post_id)
|
||||||
url = URI.parse("#{Danbooru.config.reportbooru_server}/post_views/#{post_id}?date=#{date}")
|
url = URI.parse("#{Danbooru.config.reportbooru_server}/post_views/#{post_id}")
|
||||||
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 6))
|
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 6))
|
||||||
if response.success?
|
if response.success?
|
||||||
return JSON.parse(response.body)
|
return JSON.parse(response.body)
|
||||||
|
|||||||
Reference in New Issue
Block a user