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
aqi: :integer,
area: :string,
co: :float,
co_24: :float,
co_24h: :float,
no2: :float,
no2_24: :float,
no2_24h: :float,
o3: :float,
o3_24: :float,
o3_24h: :float,
o3_8h: :float,
o3_8h_24: :float,
o3_8h_24h: :float,
pm10: :float,
pm10_24: :float,
pm10_24h: :float,
pm2_5: :float,
pm2_5_24: :float,
pm2_5_24h: :float,
position_name: :string,
primary_pollutant: :string,
quality: :string,
so2: :float,
so2_24h: :float,
station_code: :string,
time_point: :dateime,
time_point: :datetime,
},
options: {
index: %i[area, time_point],
index: %i[area time_point],
expire: 2 * 24 * 60 * 60,
unique: nil,
belongs_to: nil,
......@@ -108,7 +108,7 @@ module WeatherModel
"so2" => 10,
"so2_24h" => 13,
"station_code" => "1885A",
"time_point" => "2017-05-21T16:00:00Z",
"time_point" => Time.parse("2017-05-21 16:00:00"),
},
}
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