From c6a762c1860851c68438b4bad134a52872417611 Mon Sep 17 00:00:00 2001 From: takatama Date: Fri, 14 Jul 2023 23:13:26 +0900 Subject: [PATCH 1/5] Add items for calendar to events.json --- app/models/upcoming_event.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/models/upcoming_event.rb b/app/models/upcoming_event.rb index 5656945b2..1ac2f800c 100644 --- a/app/models/upcoming_event.rb +++ b/app/models/upcoming_event.rb @@ -45,12 +45,16 @@ def for_dojo_map list_of_dojo_and_events.each do |dojo, events| event = events.sort_by(&:event_at).first result << { - id: dojo.id, - name: dojo.name, - url: dojo.url, - event_title: event[:event_title], - event_date: event[:event_at], - event_url: event[:event_url], + id: dojo.id, + name: dojo.name, + url: dojo.url, + event_id: event[:id], + event_title: event[:event_title], + event_date: event[:event_at], + event_end_at: event[:event_end_at], + event_url: event[:event_url], + prefecture: dojo.prefecture.name, + participants: event[:participants] } end From aec24491e6408c322165d71ddb80cde2ff3a3e86 Mon Sep 17 00:00:00 2001 From: takatama Date: Sat, 15 Jul 2023 00:20:05 +0900 Subject: [PATCH 2/5] Create migration for calendar events --- .../20230714141908_add_details_to_upcoming_events.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20230714141908_add_details_to_upcoming_events.rb diff --git a/db/migrate/20230714141908_add_details_to_upcoming_events.rb b/db/migrate/20230714141908_add_details_to_upcoming_events.rb new file mode 100644 index 000000000..f8707a14c --- /dev/null +++ b/db/migrate/20230714141908_add_details_to_upcoming_events.rb @@ -0,0 +1,8 @@ +class AddDetailsToUpcomingEvents < ActiveRecord::Migration[6.1] + def change + add_column :upcoming_events, :event_update_at, :datetime + add_column :upcoming_events, :address, :string + add_column :upcoming_events, :place, :string + add_column :upcoming_events, :limit, :integer + end +end From f30f2d88f2b88f41ae2e47ecb91a8bd5c1c05e60 Mon Sep 17 00:00:00 2001 From: takatama Date: Sat, 15 Jul 2023 00:20:34 +0900 Subject: [PATCH 3/5] After migration for calendar events --- db/schema.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index c4f8d9524..283d1b28c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_03_07_132540) do +ActiveRecord::Schema.define(version: 2023_07_14_141908) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" @@ -100,6 +100,10 @@ t.integer "participants", null: false t.string "event_title", null: false t.datetime "event_end_at", null: false + t.datetime "event_update_at" + t.string "address" + t.string "place" + t.integer "limit" t.index ["dojo_event_service_id"], name: "index_upcoming_events_on_dojo_event_service_id" t.index ["service_name", "event_id"], name: "index_upcoming_events_on_service_name_and_event_id", unique: true end From 17d637dc20a22f12127f182a1caf43788c4cf7f6 Mon Sep 17 00:00:00 2001 From: takatama Date: Sat, 15 Jul 2023 00:22:42 +0900 Subject: [PATCH 4/5] Add update logic for calendar events --- lib/upcoming_events/tasks/connpass.rb | 6 +++++- lib/upcoming_events/tasks/doorkeeper.rb | 6 +++++- spec/factories/upcoming_events.rb | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/upcoming_events/tasks/connpass.rb b/lib/upcoming_events/tasks/connpass.rb index d1b5d0198..1d8da4a83 100644 --- a/lib/upcoming_events/tasks/connpass.rb +++ b/lib/upcoming_events/tasks/connpass.rb @@ -19,7 +19,11 @@ def run event_url: e['event_url'], event_at: Time.zone.parse(e['started_at']), event_end_at: Time.zone.parse(e['ended_at']), - participants: e['accepted']) + participants: e['accepted'], + event_update_at: Time.zone.parse(e['updated_at']), + address: e['address'], + place: e['place'], + limit: e['limit']) end end end diff --git a/lib/upcoming_events/tasks/doorkeeper.rb b/lib/upcoming_events/tasks/doorkeeper.rb index 7201e0ec6..fedf25653 100644 --- a/lib/upcoming_events/tasks/doorkeeper.rb +++ b/lib/upcoming_events/tasks/doorkeeper.rb @@ -19,7 +19,11 @@ def run event_url: e['public_url'], participants: e['participants'], event_at: Time.zone.parse(e['starts_at']), - event_end_at: Time.zone.parse(e['ends_at'])) + event_end_at: Time.zone.parse(e['ends_at']), + event_update_at: Time.zone.parse(e['updated_at']), + address: e['address'], + place: e['venue_name'], + limit: e['ticket_limit']) end end end diff --git a/spec/factories/upcoming_events.rb b/spec/factories/upcoming_events.rb index 02039fa66..d23196291 100644 --- a/spec/factories/upcoming_events.rb +++ b/spec/factories/upcoming_events.rb @@ -9,6 +9,10 @@ event_at { '2019-05-01 10:00'.in_time_zone } event_end_at { '2019-05-01 13:00'.in_time_zone } participants { 1 } + event_update_at { '2019-05-01 09:00'.in_time_zone } + address { '東京都新宿区高田馬場1丁目28−10' } + place { 'CASE Shinjuku 三慶ビル 4階' } + limit { 10 } end end From d1360625ec8f9996121d84accd5c4e8511002228 Mon Sep 17 00:00:00 2001 From: takatama Date: Sat, 15 Jul 2023 00:23:21 +0900 Subject: [PATCH 5/5] Add items for calendar to events.json --- app/models/upcoming_event.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/upcoming_event.rb b/app/models/upcoming_event.rb index 1ac2f800c..aa90d25db 100644 --- a/app/models/upcoming_event.rb +++ b/app/models/upcoming_event.rb @@ -54,7 +54,11 @@ def for_dojo_map event_end_at: event[:event_end_at], event_url: event[:event_url], prefecture: dojo.prefecture.name, - participants: event[:participants] + participants: event[:participants], + event_update_at: event[:event_update_at], + address: event[:address], + place: event[:place], + limit: event[:limit] } end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy