Fix timezone parsing for google calendar

This commit is contained in:
Ari Timonen 2015-04-02 04:01:41 +03:00
parent 59000309db
commit f7d7c429da
4 changed files with 7 additions and 52 deletions

View file

@ -1,6 +1,6 @@
source 'http://rubygems.org' source 'http://rubygems.org'
ruby '2.1.3' ruby '2.2.1'
gem 'dotenv-rails', '~> 0.10.0' gem 'dotenv-rails', '~> 0.10.0'
gem 'rails', '~> 3.2.19' gem 'rails', '~> 3.2.19'

View file

@ -70,8 +70,8 @@ class Gather < ActiveRecord::Base
def self.player_count_for_game(name) def self.player_count_for_game(name)
game = self.find_game(name) game = self.find_game(name)
if game && players = game.gathers.ordered.first.gatherers if game && (players = game.gathers.ordered.first.gatherers.count)
players.size players
else else
0 0
end end

View file

@ -98,11 +98,11 @@ class GoogleCalendar
end end
def start def start
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["start"]["dateTime"]) } @entry["start"]["dateTime"].to_datetime.in_time_zone(@timezone_offset)
end end
def end def end
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["end"]["dateTime"]) } @entry["end"]["dateTime"].to_datetime.in_time_zone(@timezone_offset)
end end
def formatted_summary def formatted_summary

View file

@ -11,21 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140810224606) do ActiveRecord::Schema.define(:version => 20141010193221) do
create_table "admin_requests", :force => true do |t|
t.string "addr"
t.string "pwd"
t.integer "server_id"
t.string "player"
t.integer "user_id"
t.string "msg"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "admin_requests", ["server_id"], :name => "index_admin_requests_on_server_id"
add_index "admin_requests", ["user_id"], :name => "index_admin_requests_on_user_id"
create_table "article_versions", :force => true do |t| create_table "article_versions", :force => true do |t|
t.integer "article_id" t.integer "article_id"
@ -214,16 +200,6 @@ ActiveRecord::Schema.define(:version => 20140810224606) do
add_index "data_files", ["directory_id"], :name => "index_data_files_on_directory_id" add_index "data_files", ["directory_id"], :name => "index_data_files_on_directory_id"
add_index "data_files", ["related_id"], :name => "index_data_files_on_related_id" add_index "data_files", ["related_id"], :name => "index_data_files_on_related_id"
create_table "deleteds", :force => true do |t|
t.integer "deletable_id"
t.string "deletable_type"
t.integer "user_id"
t.text "reason"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "related_id"
end
create_table "directories", :force => true do |t| create_table "directories", :force => true do |t|
t.string "name" t.string "name"
t.string "description" t.string "description"
@ -236,21 +212,6 @@ ActiveRecord::Schema.define(:version => 20140810224606) do
add_index "directories", ["parent_id"], :name => "index_directories_on_parent_id" add_index "directories", ["parent_id"], :name => "index_directories_on_parent_id"
create_table "firms", :force => true do |t|
t.string "name"
t.string "y_code"
t.string "email"
t.string "website"
t.string "phone"
t.string "address"
t.integer "zipcode"
t.string "town"
t.integer "owner"
t.string "opentime"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "forumers", :force => true do |t| create_table "forumers", :force => true do |t|
t.integer "forum_id" t.integer "forum_id"
t.integer "group_id" t.integer "group_id"
@ -294,6 +255,7 @@ ActiveRecord::Schema.define(:version => 20140810224606) do
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "votes", :default => 0, :null => false t.integer "votes", :default => 0, :null => false
t.integer "status", :default => 0, :null => false
end end
add_index "gatherers", ["gather_id"], :name => "index_gatherers_on_gather_id" add_index "gatherers", ["gather_id"], :name => "index_gatherers_on_gather_id"
@ -517,13 +479,6 @@ ActiveRecord::Schema.define(:version => 20140810224606) do
add_index "movies", ["status"], :name => "index_movies_on_status" add_index "movies", ["status"], :name => "index_movies_on_status"
add_index "movies", ["user_id"], :name => "index_movies_on_user_id" add_index "movies", ["user_id"], :name => "index_movies_on_user_id"
create_table "nodes", :force => true do |t|
t.string "name"
t.integer "foreign_key"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "options", :force => true do |t| create_table "options", :force => true do |t|
t.string "option" t.string "option"
t.integer "poll_id" t.integer "poll_id"