• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxobjective-cc#cocoa誰得qtrubybathyscaphegamephpguiwindows翻訳cpythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

コミットメタ情報

リビジョン3f6142e14be20c059148afa871400919af88647f (tree)
日時2017-08-11 07:07:41
作者HMML <hmml3939@gmai...>
コミッターHMML

ログメッセージ

Fix date calculate with timezone...

変更サマリ

差分

--- a/app/controllers/api/v1/forecasts_controller.rb
+++ b/app/controllers/api/v1/forecasts_controller.rb
@@ -11,7 +11,7 @@ class Api::V1::ForecastsController < ApplicationController
1111 @area = Area.find_by!(ns: params.require(:area_ns), code: params.require(:area_code))
1212 @area.timezone? and
1313 Time.zone = @area.timezone
14- start_date = (Time.now - 4.hours).to_date
14+ start_date = Time.zone.now.to_date
1515 @forecasts = @area.forecasts.where('date >= ?', start_date).order(date: :asc)
1616 end
1717 end
--- a/app/jobs/fetch_jma_content_job.rb
+++ b/app/jobs/fetch_jma_content_job.rb
@@ -116,7 +116,7 @@ class FetchJmaContentJob < ApplicationJob
116116 end
117117 end
118118 changed_area_ids.present? and
119- Forecast.where("area_id IN (?) AND date < ?", changed_area_ids, Time.now.to_date).destroy_all
119+ Forecast.where("area_id IN (?) AND date < ?", changed_area_ids, (Time.zone.now - 1.day).to_date).destroy_all
120120 end # Area.transaction
121121 end
122122