Skip to content

Commit b934c41

Browse files
committed
feat: ノート欄の日付抽出を改善(スラッシュ区切りに対応)
API対応していないサービス(Google Forms、Peatixなど)を使用する 道場でも、ノート欄に日付を記録すれば開催日カラムに表示されるよう改善: **正規表現の改善:** - 従来: YYYY-MM-DD 形式のみ - 改善後: YYYY-MM-DD と YYYY/MM/DD 両方に対応 - パターン: /(\d{4}-\d{1,2}-\d{1,2}|\d{4}\/\d{1,2}\/\d{1,2})/ **対応例:** - 'Active for years - 2025-03-16 https://...' → 2025-03-16 - 'Active for years - 2025/03/16 https://...' → 2025-03-16 - 'events on 2025/01/15' → 2025-01-15 **テスト結果:** ✅ ハイフン・スラッシュ両方の形式で正常動作 ✅ Time.zone.parse による統一形式での解析 ✅ 既存テンプレートロジックとの互換性 ✅ リンク抽出機能も正常動作
1 parent 01ba586 commit b934c41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/controllers/dojos_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ def activity
115115
@latest_event_by_dojos = []
116116
Dojo.active.each do |dojo|
117117
link_in_note = dojo.note.match(URI.regexp)
118-
date_in_note = dojo.note.match(/(\d{4}-\d{1,2}-\d{1,2})/) # YYYY-MM-DD
118+
# YYYY-MM-DD または YYYY/MM/DD 形式の日付を抽出
119+
date_in_note = dojo.note.match(/(\d{4}-\d{1,2}-\d{1,2}|\d{4}\/\d{1,2}\/\d{1,2})/)
119120

120121
latest_event = dojo.event_histories.newest.first
121122

0 commit comments

Comments
 (0)