fix error
This commit is contained in:
parent
919025b9b7
commit
d324d141d0
|
@ -48,12 +48,15 @@ private
|
|||
cache = RulingBusCache.where(bus_info_id: bus_info_id).first
|
||||
if (cache.nil? || cache.updated_at < @time_thresh)
|
||||
tmp = RulingBusesHelper.get_stop_time(bus_info,@bus_locale)
|
||||
if cache.nil?
|
||||
RulingBusCache.create(dict: tmp, bus_info_id: bus_info_id)
|
||||
if !tmp.nil?
|
||||
if cache.nil?
|
||||
RulingBusCache.create(dict: tmp, bus_info_id: bus_info_id)
|
||||
else
|
||||
cache.update_attributes(dict: tmp, updated_at: Time.now)
|
||||
end
|
||||
else
|
||||
cache.update_attributes(dict: tmp)
|
||||
tmp = cache.dict
|
||||
end
|
||||
tmp
|
||||
else
|
||||
tmp = cache.dict
|
||||
end
|
||||
|
|
|
@ -126,6 +126,9 @@ module RulingBusesHelper
|
|||
end.join(' or ')
|
||||
url = "/Bus/EstimatedTimeOfArrival/City/#{city}?$select=Direction,RouteName,NextBusTime&$filter=#{filters}&$format=JSON&$orderby=RouteName/#{locale}"
|
||||
bus_data = JSON.parse(self.get(url).body)
|
||||
if bus_data.class==Hash
|
||||
return nil
|
||||
end
|
||||
if !cache_data_pbus.blank?
|
||||
filters = cache_data_pbus.map do |k,v|
|
||||
("((StopName/#{locale} eq '#{k[0][locale]}') and Direction eq #{k[2]} and " +
|
||||
|
@ -136,7 +139,11 @@ module RulingBusesHelper
|
|||
else
|
||||
pbus_data = []
|
||||
end
|
||||
bus_data + pbus_data
|
||||
if pbus_data.class==Hash
|
||||
bus_data
|
||||
else
|
||||
bus_data + pbus_data
|
||||
end
|
||||
end
|
||||
|
||||
def get_input_name
|
||||
|
|
Loading…
Reference in New Issue