Commit ff582435 by ivan Lan

Fix aqi_live

parent 7253acba
class CreateRealtimeAqi < ActiveRecord::Migration[5.0]
def up
create_table :realtime_aqi do |t|
t.datetime :datetime
t.integer :aqi
t.string :level
t.string :pripoll
t.string :content
t.string :measure
t.timestamps
end
add_index :realtime_aqi, :datetime
end
def down
drop_table :realtime_aqi
end
end
...@@ -59,27 +59,27 @@ module WeatherModel ...@@ -59,27 +59,27 @@ module WeatherModel
aqi: :integer, aqi: :integer,
area: :string, area: :string,
co: :float, co: :float,
co_24: :float, co_24h: :float,
no2: :float, no2: :float,
no2_24: :float, no2_24h: :float,
o3: :float, o3: :float,
o3_24: :float, o3_24h: :float,
o3_8h: :float, o3_8h: :float,
o3_8h_24: :float, o3_8h_24h: :float,
pm10: :float, pm10: :float,
pm10_24: :float, pm10_24h: :float,
pm2_5: :float, pm2_5: :float,
pm2_5_24: :float, pm2_5_24h: :float,
position_name: :string, position_name: :string,
primary_pollutant: :string, primary_pollutant: :string,
quality: :string, quality: :string,
so2: :float, so2: :float,
so2_24h: :float, so2_24h: :float,
station_code: :string, station_code: :string,
time_point: :dateime, time_point: :datetime,
}, },
options: { options: {
index: %i[area, time_point], index: %i[area time_point],
expire: 2 * 24 * 60 * 60, expire: 2 * 24 * 60 * 60,
unique: nil, unique: nil,
belongs_to: nil, belongs_to: nil,
...@@ -108,7 +108,7 @@ module WeatherModel ...@@ -108,7 +108,7 @@ module WeatherModel
"so2" => 10, "so2" => 10,
"so2_24h" => 13, "so2_24h" => 13,
"station_code" => "1885A", "station_code" => "1885A",
"time_point" => "2017-05-21T16:00:00Z", "time_point" => Time.parse("2017-05-21 16:00:00"),
}, },
} }
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment