File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,6 +143,11 @@ def activity
143143 }
144144 end
145145
146+ # 同じイベントサービスを共有している道場の開催日を同期
147+ # 生駒 (ID: 36) と平群 (ID: 294) は奈良 (ID: 35) と同じ connpass を使用
148+ sync_event_date ( 36 , 35 ) # 生駒は奈良の開催日を参照
149+ sync_event_date ( 294 , 35 ) # 平群は奈良の開催日を参照
150+
146151 # アクティブな道場と非アクティブな道場を分けてソート
147152 active_dojos = @latest_event_by_dojos . select { |d | d [ :is_active ] }
148153 inactive_dojos = @latest_event_by_dojos . reject { |d | d [ :is_active ] }
@@ -165,6 +170,19 @@ def activity
165170
166171 private
167172
173+ # 指定された道場の開催日を別の道場の開催日と同期する
174+ # @param target_dojo_id [Integer] 更新対象の道場ID
175+ # @param source_dojo_id [Integer] 参照元の道場ID
176+ def sync_event_date ( target_dojo_id , source_dojo_id )
177+ source_dojo = @latest_event_by_dojos . find { |d | d [ :id ] == source_dojo_id }
178+ target_dojo = @latest_event_by_dojos . find { |d | d [ :id ] == target_dojo_id }
179+
180+ if source_dojo && target_dojo
181+ target_dojo [ :latest_event_at ] = source_dojo [ :latest_event_at ]
182+ target_dojo [ :latest_event_url ] = source_dojo [ :latest_event_url ]
183+ end
184+ end
185+
168186 def parse_date_from_note ( date_match )
169187 return nil if date_match . nil?
170188
You can’t perform that action at this time.
0 commit comments