Skip to content

Feature/game training kind - #151

Merged
denis1011101 merged 3 commits into
mainfrom
feature/game-training-kind
Aug 20, 2026
Merged

Feature/game training kind#151
denis1011101 merged 3 commits into
mainfrom
feature/game-training-kind

Conversation

@denis1011101

Copy link
Copy Markdown
Owner

No description provided.

denis1011101 and others added 2 commits August 21, 2026 01:57
Создание и редактирование игры теперь начинается с выбора: игра или
тренировка. Тренеры бывают только у тренировки, поэтому их поля уехали
под этот переключатель, и тренеров можно выбрать двух — каждый получает
своё приглашение и отвечает на него сам.

Приглашение, подтверждение дат, расписание тренера и напоминания
работают для обоих слотов. Старые игры с тренером стали тренировками:
тренер без тренировки не бывает и в обратную сторону.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Тренеров у тренировки бывает двое, и coach_accepted? теперь значит
«принял хоть один». Право на рассылку ролика спрашиваем про конкретного
человека, иначе первый тренер получал его по чужому согласию, а второй
не получал по своему.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8639222cab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


def authorize_coach!
head :forbidden unless @game.coach_accepted? && @game.coach == current_user
head :forbidden unless @game.accepted_coach?(current_user)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Scope prebooking deletion to the requesting coach

When a training has two accepted coaches, this authorization allows either coach into destroy, while that action finds the booking only through the game. A coach can therefore submit the other coach's booking ID and cancel their confirmation; scope the lookup to current_user or verify the booking's coach_id before deletion.

Useful? React with 👍 / 👎.

Comment thread app/controllers/games_controller.rb Outdated
Comment on lines +95 to +96
invited_coaches = @game.coaches.reject { |coach| previous_coach_ids.include?(coach.id) }
invited_coaches.each { |coach| deliver_coach_invitation(coach) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Re-invite coaches after moving them between slots

When existing coaches are swapped between the primary and secondary slots—or the secondary coach is promoted after clearing the primary—model normalization resets the moved coach's invitation status to pending. Because this filter compares only against the unordered set of previous IDs, it then excludes that coach from delivery, leaving them pending without a new invitation; detect per-slot changes or invite coaches whose status was newly reset.

Useful? React with 👍 / 👎.

Отмена подтверждённой даты теперь ищет бронь среди своих: у тренировки
двух тренеров чужой id брони приходит тем же маршрутом, и второй тренер
мог снять подтверждение первого.

Приглашение уходит по смене слота, а не набора тренеров. Если тренеров
поменять местами или поднять второго на место первого, модель сбрасывает
статусы в pending — а по одному только набору id никто нового
приглашения не получал и оба оставались висеть.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@denis1011101
denis1011101 merged commit 4f9f759 into main Aug 20, 2026
4 checks passed
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.

1 participant