Skip to content

近日開催のイベントにWIPのイベントが表示されるバグを修正#9796

Open
s-tone-gs wants to merge 7 commits intomainfrom
bug/upcoming-events-section-displays-WIP-events
Open

近日開催のイベントにWIPのイベントが表示されるバグを修正#9796
s-tone-gs wants to merge 7 commits intomainfrom
bug/upcoming-events-section-displays-WIP-events

Conversation

@s-tone-gs
Copy link
Copy Markdown
Contributor

@s-tone-gs s-tone-gs commented Mar 16, 2026

Issue

概要

  • ダッシュボードの近日開催のイベント欄にWIP状態のイベントが表示されないようにした

#9737 (comment) の方針に沿い、以下の修正も同時に行った。

  • Discordのイベントのお知らせにWIP状態のイベントが表示されないようにした
  • 定期イベント一覧の開催中のイベントにWIP状態のイベントが出現しないようにした

変更確認方法

1. ダッシュボードの近日開催のイベント欄にWIPのイベントが表示されない

  1. bug/upcoming-events-section-displays-WIP-eventsをローカルに取り込む
  2. 開発サーバーを起動
  3. hajimeでログイン(ユーザーは誰でもよい)
  1. http://localhost:3000/events/new にアクセスする
  2. 開催日時が翌日の特別イベントを作成、WIP状態にする
  3. http://localhost:3000/regular_events/new にアクセスする
  4. 開催日時が翌日の定期イベントを作成、WIP状態にする
  5. http://localhost:3000/ にアクセス
  6. 近日開催のイベント欄に5, 7で作成したWIPのイベントが表示されていないことを確認する

2. 定期イベント一覧の開催中のイベントにWIPのイベントが表示されない

  1. http://localhost:3000/regular_events?target=not_finished にアクセスする
  2. 1. ダッシュボードの近日開催のイベント欄にWIPのイベントが表示されないの手順7で作成したWIPの定期イベントが表示されていないことを確認する

3. Discordの開催予定の定期イベントの通知にWIPのイベントが含まれない

  1. https://github.com/fjordllc/bootcamp/wiki/Develop%E7%92%B0%E5%A2%83%E3%81%A7%E3%81%AEDiscord%E9%80%9A%E7%9F%A5%E3%81%AE%E7%A2%BA%E8%AA%8D%E6%96%B9%E6%B3%95 を参考にDiscrodで通知を受け取るためのセットアップをする
    app/models/chat_notifier.rbの編集は行わず、代わりにapp/models/discord_driver.rbを以下のように修正する。
Discord::Notifier.message(
      params[:body],
      username: params[:name],
-     url: params[:webhook_url]
+     url: '取得したウェブフックURL'
    )
  1. app/controllers/scheduler_controller.rb:require_tokenをコメントアウトして一時的に無効化する
class SchedulerController < ApplicationController
  skip_before_action :require_active_user_login, raise: false
  skip_before_action :verify_authenticity_token
-  before_action :require_token
+  # before_action :require_token
  1. curl http://localhost:3000/scheduler/daily/notify_coming_soon_regular_events を実行する。
  2. 手順2で作成したDiscordサーバーに届いた通知に、1. ダッシュボードの近日開催のイベント欄にWIPのイベントが表示されないの手順7で作成したWIPの定期イベントが含まれていないことを確認する
  3. 手順1,2の修正を破棄する
    git restore app/models/discord_driver.rb app/controllers/scheduler_controller.rb

Screenshot

1. ダッシュボードの近日開催のイベント欄にWIPのイベントを表示しない

変更前

スクリーンショット 2026-03-16 170643

変更後

スクリーンショット 2026-03-16 170529

2. 定期イベント一覧の開催中のイベントにWIPのイベントを表示しない

変更前

image

変更後

image

3. Discordの開催予定の定期イベントの通知にWIPのイベントが含まれない

使用するWIPのイベント

image

変更前

スクリーンショット 2026-03-25 101729

変更後

image

Summary by CodeRabbit

  • 改善
    • イベント一覧のフィルタリングを強化し、作業中のイベント(WIP)を表示対象から除外するようになりました。
  • 変更
    • 「今後のイベント」を取得する公開スコープ名と挙動を整理し、未終了かつ公開済みでWIPを除く条件に統一しました。ビューの一部で表示対象の定期イベント集合が変わり、編集リンクの一覧に影響します。
  • テスト
    • テストフィクスチャを複数追加・更新し、期待件数や除外条件のアサーションを調整しました。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Event/RegularEventのスコープをscheduled_on_without_endedからupcoming_fromへ置き換えし、wip: falseでWIPを除外するよう変更。UpcomingEventやビュー、テスト、テスト/DBフィクスチャがそれに合わせて更新された。

Changes

Cohort / File(s) Summary
モデル:Event/RegularEvent スコープ変更
app/models/event.rb, app/models/regular_event.rb
scheduled_on_without_ended(date)を削除し、upcoming_from(date)を追加/使用。holdingwhere(finished: false, wip: false)に変更され、fetch_target_events('not_finished')等の参照がholdingへ置換された。
UpcomingEvent 呼び出し更新
app/models/upcoming_event.rb
original_events_scheduled_on(date)scheduled_on_without_endedupcoming_fromへ呼び出しを変更(結果集合からWIPが除外される)。
ビューのスコープ差し替え
app/views/hibernation/new.html.slim, app/views/retirement/new.html.slim
ビュー側で参照する定期イベント集合をholdingnot_finishedへ変更(表示対象の集合が変化)。
テストコードの更新
test/models/event_test.rb, test/models/regular_event_test.rb, test/system/regular_events_test.rb, test/system/notification/regular_events_test.rb
テスト呼び出しをscheduled_on_without_endedupcoming_fromへ変更。WIP除外に合わせた期待値・アサーション調整、システムテストの期待件数更新、Discord通知テストでWIP非表示の否定チェック追加。
テストフィクスチャの追加・修正(test)
test/fixtures/events.yml, test/fixtures/regular_events.yml, test/fixtures/regular_event_repeat_rules.yml
event36の終了時刻延長、event37/event38regular_event42/regular_event43および対応する繰返しルールを追加(WIP含む)。
DBフィクスチャの追加
db/fixtures/events.yml, db/fixtures/regular_events.yml, db/fixtures/regular_event_repeat_rules.yml
DB用フィクスチャにWIPイベント/定期イベントと繰返しルールを追加。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • komagata
  • okuramasafumi

Poem

🐇 小さなスコープをぴょんと変えたよ
WIPはそっと影へ帰る
フィクスチャ増えて朝は賑やか
テストは跳ねて確かめるよ
コードの畑で僕は踊る 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed タイトルはPRの主要な変更内容(ダッシュボードのWIPイベント表示バグの修正)を明確に要約しており、開発者の視点から重要な変更をよく表現している。
Description check ✅ Passed プルリクエスト説明は日本語で記述されており、Issue番号、概要、変更確認方法、スクリーンショットを含む構造化されたテンプレートに従っています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/upcoming-events-section-displays-WIP-events

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@s-tone-gs s-tone-gs marked this pull request as ready for review March 16, 2026 08:12
@github-actions github-actions bot requested a review from okuramasafumi March 16, 2026 08:12
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/models/regular_event_test.rb (1)

176-183: ⚠️ Potential issue | 🔴 Critical

RegularEvent.upcomingメソッドが未定義です

179行目でRegularEvent.upcoming(tomorrow)を呼び出していますが、app/models/regular_event.rbにはupcomingスコープが定義されていません。定義されているのはupcoming_fromのみです。

このテストはNoMethodErrorで失敗します。

🐛 修正案:upcoming_fromを使用する
 test '.upcoming in tomorrow's event' do
   travel_to Time.zone.local(2024, 12, 1, 10, 0, 0) do
     tomorrow = Time.zone.tomorrow
-    regular_events = RegularEvent.upcoming(tomorrow)
+    regular_events = RegularEvent.upcoming_from(tomorrow)
     regular_event_scheduled_for_tomorrow = regular_events(:regular_event38)
     assert_includes regular_events, regular_event_scheduled_for_tomorrow
   end
 end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/models/regular_event_test.rb` around lines 176 - 183, The test calls
RegularEvent.upcoming(tomorrow) but there is no upcoming scope on RegularEvent;
replace that call with the existing scope/method
RegularEvent.upcoming_from(tomorrow) (or alternatively add an alias scope def
scope :upcoming, ->(date) { upcoming_from(date) } in the RegularEvent model) so
the test uses a defined method (referenced symbols: RegularEvent.upcoming,
RegularEvent.upcoming_from, scope :upcoming).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/models/regular_event.rb`:
- Line 54: The test calls RegularEvent.upcoming(date) but only scope
:upcoming_from is defined; add a new scope named upcoming that delegates to
upcoming_from (e.g., define scope :upcoming, ->(date) { upcoming_from(date) })
so calls to RegularEvent.upcoming(date) work; update the RegularEvent model by
adding this scope (referencing the existing upcoming_from scope and the
RegularEvent.upcoming symbol).

---

Outside diff comments:
In `@test/models/regular_event_test.rb`:
- Around line 176-183: The test calls RegularEvent.upcoming(tomorrow) but there
is no upcoming scope on RegularEvent; replace that call with the existing
scope/method RegularEvent.upcoming_from(tomorrow) (or alternatively add an alias
scope def scope :upcoming, ->(date) { upcoming_from(date) } in the RegularEvent
model) so the test uses a defined method (referenced symbols:
RegularEvent.upcoming, RegularEvent.upcoming_from, scope :upcoming).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 926d6618-1a66-4b66-b739-f21c9b111e0f

📥 Commits

Reviewing files that changed from the base of the PR and between 874caae and 106d2ea.

📒 Files selected for processing (8)
  • app/models/event.rb
  • app/models/regular_event.rb
  • app/models/upcoming_event.rb
  • test/fixtures/events.yml
  • test/fixtures/regular_event_repeat_rules.yml
  • test/fixtures/regular_events.yml
  • test/models/event_test.rb
  • test/models/regular_event_test.rb

@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch from 106d2ea to 74ab45b Compare March 16, 2026 09:26
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
db/fixtures/regular_events.yml (1)

143-144: Time.current依存をfixtureから外した方が安全です。

Line 143 と Line 144 は実行時刻に依存するため、fixtureの再現性が下がります。fixtureは固定時刻にし、未来/過去の条件はテスト側で時刻固定して検証する構成が安定します。

🔧 提案差分
-  start_at: <%= Time.current + 1.day %>
-  end_at: <%= Time.current + 1.day + 1.hours %>
+  start_at: <%= Time.zone.local(2020, 1, 1, 21, 0, 0) %>
+  end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %>

Based on learnings: In YAML fixture files under db/fixtures, using fixed past timestamps (e.g., Time.zone.parse('2025-01-01 00:00:00')) can help test reproducibility. This is acceptable; ensure tests remain deterministic by avoiding reliance on current time, and document the chosen fixed values if they influence test outcomes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db/fixtures/regular_events.yml` around lines 143 - 144, Replace the
runtime-dependent Time.current expressions in the fixture fields start_at and
end_at with fixed, deterministic timestamps (e.g., use
Time.zone.parse('2025-01-01 00:00:00') for start_at and add 1.hour for end_at)
so the YAML fixture is reproducible; update the two keys start_at and end_at
accordingly and document the chosen fixed timestamp in the fixture comment if it
affects tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@db/fixtures/regular_event_repeat_rules.yml`:
- Around line 94-97:
YAMLで同じキー名「regular_event_repeat_rule35」が2回定義されているため最初の定義が上書きされている問題を修正してください:2つ目のエントリ(現在
regular_event_repeat_rule35 として regular_event31 を指すブロック)をユニークなキー名(例:
regular_event_repeat_rule36)に変更し、必要ならそれを参照する関連フィクスチャや参照先(regular_event30 /
regular_event31 の関連付け)を合わせて更新して重複を解消してください。

---

Nitpick comments:
In `@db/fixtures/regular_events.yml`:
- Around line 143-144: Replace the runtime-dependent Time.current expressions in
the fixture fields start_at and end_at with fixed, deterministic timestamps
(e.g., use Time.zone.parse('2025-01-01 00:00:00') for start_at and add 1.hour
for end_at) so the YAML fixture is reproducible; update the two keys start_at
and end_at accordingly and document the chosen fixed timestamp in the fixture
comment if it affects tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3a80f6d7-f98d-41c6-b54c-768ca5af6f3f

📥 Commits

Reviewing files that changed from the base of the PR and between 106d2ea and 14f844a.

📒 Files selected for processing (12)
  • app/models/event.rb
  • app/models/regular_event.rb
  • app/models/upcoming_event.rb
  • db/fixtures/events.yml
  • db/fixtures/regular_event_repeat_rules.yml
  • db/fixtures/regular_events.yml
  • test/fixtures/events.yml
  • test/fixtures/regular_event_repeat_rules.yml
  • test/fixtures/regular_events.yml
  • test/models/event_test.rb
  • test/models/regular_event_test.rb
  • test/system/regular_events_test.rb
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/models/event_test.rb
  • test/models/regular_event_test.rb

@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch from 14f844a to 9ad9801 Compare March 17, 2026 02:11
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

s-tone-gs commented Mar 24, 2026

@machida
お疲れ様です。
#9737 (comment) で報告させていただいた、定期イベント一覧の開催中の欄にWIP状態のものが表示されている件についてです。

こちらですが、バグとして新しくissueを立て、修正自体はこのPRの中で同時にやってしまおうかと考えています。
CIで落ちたテストが報告させていただいたバグに関連するものだったからです。
ref: https://app.circleci.com/pipelines/github/fjordllc/bootcamp/16219/workflows/0d673082-4f6b-460e-ab27-772e4d25ba0b/jobs/60768/tests

状況としては、今回作成したWIPの定期イベントのテストデータが開催中の定期イベントとしてカウントされてしまい、開催中の定期イベントの数が増えて以下のようにテストが落ちています。

expected to find visible css ".card-list.a-card .card-list-item" 22 times, found 23 matches:

こちらはテストではなく機能を修正するべき案件だと判断したのですが、バグとして新しくissueを立て、修正自体はこのPRの中で同時にやってしまう、という方向で作業を進めても良いでしょうか??

@machida
Copy link
Copy Markdown
Member

machida commented Mar 24, 2026

@s-tone-gs それについては、Issueは特に追加せず、同じPRで作業してしまって大丈夫です。追加仕様としてPRに詳細を追記していただけたらと思います。

実際、作って初めて気がつくことってよくあるんですよね。それも含めないと完成にならずリリースができないので、一つのIssueでお願いします🙏

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@machida 承知しました!ありがとうございます!

@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch from 9ad9801 to da3b89e Compare March 24, 2026 13:31
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/system/notification/regular_events_test.rb`:
- Around line 41-42: The two boolean checks on the message body are not
combined, so body['content'].exclude?(...) is never evaluated; update the test
assertion that uses body['content'].include?('Discord通知確認用、祝日非開催イベント(金曜日 +
土曜日開催)') and body['content'].exclude?('Discord通知が来ないwipイベント(土曜日開催)') so they are
joined with a logical AND (e.g., add the missing && between the include? and
exclude? calls) to ensure both conditions are asserted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38e48757-f520-4d2d-8e91-53a1c8025d09

📥 Commits

Reviewing files that changed from the base of the PR and between 9ad9801 and da3b89e.

📒 Files selected for processing (15)
  • app/models/event.rb
  • app/models/regular_event.rb
  • app/models/upcoming_event.rb
  • app/views/hibernation/new.html.slim
  • app/views/retirement/new.html.slim
  • db/fixtures/events.yml
  • db/fixtures/regular_event_repeat_rules.yml
  • db/fixtures/regular_events.yml
  • test/fixtures/events.yml
  • test/fixtures/regular_event_repeat_rules.yml
  • test/fixtures/regular_events.yml
  • test/models/event_test.rb
  • test/models/regular_event_test.rb
  • test/system/notification/regular_events_test.rb
  • test/system/regular_events_test.rb
✅ Files skipped from review due to trivial changes (2)
  • test/system/regular_events_test.rb
  • db/fixtures/events.yml
🚧 Files skipped from review as they are similar to previous changes (6)
  • db/fixtures/regular_event_repeat_rules.yml
  • db/fixtures/regular_events.yml
  • app/models/event.rb
  • test/fixtures/regular_events.yml
  • test/fixtures/regular_event_repeat_rules.yml
  • app/models/regular_event.rb

@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch 3 times, most recently from 6ae8aeb to e503f83 Compare March 25, 2026 02:22
wip状態のイベントの作成者をkimuraにすると
test/system/home/events_test.rbのテストに影響が出るため修正した
/test/system/regular_events_test.rbにおいて全ての定期イベントが表示されることを確認するテストがある
こちらに新しく作成したWIP状態のイベントが影響を与えた
「全ての定期イベント」という括りにはWIP状態のイベントも入ると判断し、テストを修正した
@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch from e503f83 to 93ce27d Compare March 25, 2026 09:02
Discordの近日開催のイベント通知と定期イベント一覧の開催中にWIPが表示されるバグを修正
holdingとscheduled_onという「開催する」イベントを取得するメソッドがwipを除外していなかったのが開催中の欄にwipが表示されてしまう根本的な原因だと判断し、修正した
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

🚀 Review App

URL: https://bootcamp-pr-9796-fvlfu45apq-an.a.run.app

Basic認証: fjord / (ステージングと同じ)
PR更新時に自動で再デプロイされます。

@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch 2 times, most recently from e3014b9 to fc8678a Compare March 25, 2026 09:44
修正箇所の変化によってメソッド名を変更する理由がなくなったので元に戻した
修正したモデルメソッドのテストを追加し、WIPが表示されるバグを検知できるようにシステムテストを追加、修正した
修正箇所の変更によりテスト名を変更する必要が無くなったため
@s-tone-gs s-tone-gs force-pushed the bug/upcoming-events-section-displays-WIP-events branch 3 times, most recently from 1dd452e to ecf5a74 Compare March 25, 2026 14:39
@s-tone-gs s-tone-gs requested a review from Miya096jp March 26, 2026 00:06
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@Miya096jp
お疲れ様です!レビュー依頼させていただきましたのでよろしくお願いいたします🙇‍♂️
急ぎではないですが、キャパ的に厳しい場合は教えてください!

@Miya096jp
Copy link
Copy Markdown
Contributor

@s-tone-gs

お疲れ様です!
すみません、現在対応が難しいため、別の方に依頼をお願いいたします🙇🏻‍♂️

@s-tone-gs s-tone-gs requested review from shibainurou and removed request for Miya096jp March 26, 2026 01:48
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@Miya096jp
承知しました~!お返事ありがとうございます!

@shibainurou
お疲れ様です!こちらレビューをお願いできますでしょうか?
急ぎではないですがキャパ的に厳しい場合は教えてください!

@shibainurou
Copy link
Copy Markdown
Contributor

@s-tone-gs
了解ですー!
レビューは28日29日に実施予定ですー。時間が取れなければ翌週の土日になります!

Copy link
Copy Markdown
Contributor

@shibainurou shibainurou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s-tone-gs
レビュー完了しました!
修正箇所の調査がよくできており勉強になります!
ただ、少しだけ気になった点がありますのでご確認頂けると幸いです。

  1. コードについて
    コード内にコメントしましたのでご確認お願い致します。
  2. プルリク内の確認方法について
    休会や退会したときに主催しているWIPのイベントが表示されることの確認が抜けているのでご確認お願い致します。

= form_with model: current_user, local: true, url: retirement_path, method: :post, class: 'form' do |f|
.form__items
- holding_regular_events = RegularEvent.organizer_event(current_user).holding
- holding_regular_events = RegularEvent.organizer_event(current_user).not_finished
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

取得する値がholdingからnot_finishedに変更になったので、変数名も合わせて修正したほうがよいと思われます。

| のページの「分報 URL」欄に分報チャンネルの URL を登録してください。

- holding_regular_events = RegularEvent.organizer_event(current_user).holding
- holding_regular_events = RegularEvent.organizer_event(current_user).not_finished
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

取得する値がholdingからnot_finishedに変更になったので、変数名も合わせて修正したほうがよいと思われます。

| 休会をお考えの場合、イベントの進行に影響がないよう、任意で他の参加者に主催を引き継ぐことを推奨します。
| 休会手続きを完了する前に、以下のリンク先でイベント設定変更を行なってください。
ul
- holding_regular_events.holding.each do |event|
Copy link
Copy Markdown
Contributor

@shibainurou shibainurou Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既存バグに近いのですが、ご確認お願いします。

holdingは今回の修正でWIP=falseが追加されました。
そのため、holding_regular_events.holdingでループを回すと「休会手続きを完了する前に、以下のリンク先でイベント設定変更を行なってください。」とメッセージが表示されるのに、リンク先が表示されなくなってしまいます。

holding_regular_events.holdingholding`の削除が必要だと思われます。

@@ -56,7 +56,7 @@ class RegularEvent < ApplicationRecord # rubocop:disable Metrics/ClassLength
scope :fetch_target_events, lambda { |target|
case target
when 'not_finished'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいのですがtargetの値をnot_finishedのままにすると、フロントエンドでは「開催中」に表示するイベントは「完了していないもの(WIP含む)」ように見えてしまいます。
そのためwhenのcase部分もnot_finishedからholdingに変えた方がよいと思われます。

= link_to regular_events_path(target: :not_finished), class: "pill-nav__item-link#{params[:target] == 'not_finished' ? ' is-active' : ''}" do
| 開催中

= link_to regular_events_path(target: :not_finished), class: "pill-nav__item-link#{params[:target] == 'not_finished' ? ' is-active' : ''}" do
| 開催中

ただここまで修正しなくても良いかもしれないので、一度メンターにご確認頂けると幸いです。

Copy link
Copy Markdown
Contributor Author

@s-tone-gs s-tone-gs Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machida (@shibainurou )
お疲れ様です。こちらの修正提案に関連して2点確認です。

not_finishedはwipを含むか

そもそも論になってしまうのですが、#9737 (comment) の考えに照らし合わせると、not_finishedも意味的に本来wipを含むべきではないと感じます。wipはあくまで下書きなので、完了かどうか以前の状態であるためです。こちら認識に相違ないでしょうか?

上記の考えに沿って、現状はregular_eventのnot_finishedスコープの修正を考えています。
合わせてholdingスコープとnot_finishedスコープの統合を行う予定です。

  • 変更イメージ
    app/models/regular_event.rb
-  scope :not_finished, -> { where(finished: false) }
-  scope :holding, -> { where(finished: false, wip: false) }
- scope :scheduled_on, ->(date) { holding.filter { |event| event.scheduled_on?(date) } }
- scope :scheduled_on_without_ended, ->(date) { holding.filter { |event| event.scheduled_on?(date) && !event.ended?(date) } }
+  scope :not_finished, -> { where(finished: false, wip: false) }
+ scope :scheduled_on, ->(date) { not_finished.filter { |event| event.scheduled_on?(date) } }
+ scope :scheduled_on_without_ended, ->(date) { not_finished.filter { |event| event.scheduled_on?(date) && !event.ended?(date) } }

休会・退会時に引継ぎを要求されるイベントにwipを含むか

not_finishedがwipを取得しないように修正すると、現状のコードでは休会時・退会時に引継ぎを求められるイベントにWIPが含まれなくなります。
しかし、ここではWIPを含めるべきだと考えています。引継ぎが行われずに、開催されないwipイベントが一覧に残り続けてもユーザーにとってノイズにしかならないからです。
この認識に相違が無いかを確認したいです。

上記のようにnot_finishedを修正する場合は休会・退会時の主催イベントを取得する処理にnot_finished以外のものを使用する、などの処置をしようと考えています。

  • 変更イメージ
    app/views/hibernation/new.html.slim
- holding_regular_events = RegularEvent.organizer_event(current_user).not_finished
+ holding_regular_events = RegularEvent.organizer_event(current_user).where(finished: false)

app/views/retirement/new.html.slim

- holding_regular_events = RegularEvent.organizer_event(current_user).not_finished
+ holding_regular_events = RegularEvent.organizer_event(current_user).where(finished: false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants