Skip to content

都道府県別CoderDojoカレンダーに必要な情報をEvent APIに追加する #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions app/models/upcoming_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ 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],
event_update_at: event[:event_update_at],
address: event[:address],
place: event[:place],
limit: event[:limit]
}
end

Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20230714141908_add_details_to_upcoming_events.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/upcoming_events/tasks/connpass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/upcoming_events/tasks/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/upcoming_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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