Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check report ID when detecting editing conflicts #302

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/store/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ func (s *Service) UpdateReportTx(ctx context.Context, tx *sqlx.Tx, r Report, rep
SELECT id
FROM reports
WHERE
event_key = $1 AND
match_key = $2 AND
team_key = $3 AND
reporter_id = $4`, r.EventKey, r.MatchKey, r.TeamKey, r.ReporterID)
id != $1 AND
event_key = $2 AND
match_key = $3 AND
team_key = $4 AND
reporter_id = $5`, r.ID, r.EventKey, r.MatchKey, r.TeamKey, r.ReporterID)
if err != nil && err != sql.ErrNoRows {
return fmt.Errorf("unable to check if report exists: %w", err)
} else if err == nil && !replace {
Expand Down