generated from VLADIMIR/template
fix
This commit is contained in:
@@ -86,7 +86,6 @@ func (r *TeamsRepo) AnswerParticipation(ctx context.Context, token, answer strin
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Условие проверяется повторно после снятия блокировки строки конкурентным ответом.
|
||||
_, err = r.pool.Exec(ctx, `WITH eligible_game AS (SELECT g.id FROM games g JOIN teams t ON t.game_id=g.id
|
||||
WHERE t.participation_token_hash=$1 AND g.status='draft' AND g.start_at > (clock_timestamp() AT TIME ZONE 'UTC') FOR SHARE OF g)
|
||||
UPDATE teams t SET participation_status=$2,
|
||||
|
||||
@@ -191,7 +191,6 @@ func (r *TeamsRepo) DeleteTeam(ctx context.Context, teamID int) error {
|
||||
// ErrRegistrationClosed indicates that team registration is unavailable.
|
||||
var ErrRegistrationClosed = errors.New("Игра не найдена или регистрация уже закрыта")
|
||||
|
||||
// RegisterTeam сохраняет одну команду на доставку, включая одновременные повторы.
|
||||
func (r *TeamsRepo) RegisterTeam(ctx context.Context, gameID int, deliveryID, name, email string, participantsCount int32, password string) (int, error) {
|
||||
return r.RegisterTeamWithParticipation(ctx, gameID, deliveryID, name, email, participantsCount, password, false)
|
||||
}
|
||||
@@ -199,7 +198,6 @@ func (r *TeamsRepo) RegisterTeam(ctx context.Context, gameID int, deliveryID, na
|
||||
// RegisterTeamWithParticipation registers a team and its participation data.
|
||||
func (r *TeamsRepo) RegisterTeamWithParticipation(ctx context.Context, gameID int, deliveryID, name, email string, participantsCount int32, password string, autoConfirm bool) (int, error) {
|
||||
var id int
|
||||
// Повтор уже принятой доставки успешен и после старта игры.
|
||||
err := r.pool.QueryRow(ctx, `SELECT id FROM teams WHERE game_id = $1 AND registration_delivery_id = $2`, gameID, deliveryID).Scan(&id)
|
||||
if err == nil {
|
||||
return id, nil
|
||||
@@ -223,7 +221,6 @@ func (r *TeamsRepo) RegisterTeamWithParticipation(ctx context.Context, gameID in
|
||||
return id, err
|
||||
}
|
||||
|
||||
// GetActiveTeamsByGameID исключает отменённые регистрации из игровых выгрузок и результатов.
|
||||
func (r *TeamsRepo) GetActiveTeamsByGameID(ctx context.Context, gameID int) ([]*repos.Team, error) {
|
||||
teams, err := r.GetTeamsByGameID(ctx, gameID)
|
||||
active := teams[:0]
|
||||
|
||||
Reference in New Issue
Block a user