Skip to content

feat: cancel voting (backend) - #6464

Open
mating02 wants to merge 5 commits into
mainfrom
feat/mg/cancel-voting-backend-6396
Open

feat: cancel voting (backend)#6464
mating02 wants to merge 5 commits into
mainfrom
feat/mg/cancel-voting-backend-6396

Conversation

@mating02

@mating02 mating02 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Description

I implemented a new canceled state that uses the ABORT db enum to update the voting and set its state to canceled. For this, new functions were created to cancel the voting without triggering the evaluation of the voting.

Changelog

  • new canceled state in votings/voting_status.go
  • extended the votings api with the new cancel function
  • added cancel function to votings/service.go
  • extended close function in votings/database.go to differentiate between the canceled target state and the closed target state
  • extended api endpoint in api/votings.go to also include the canceled state
  • added unit tests and integration test to ensure correct functionality

Checklist

  • I have performed a self-review of my own code
  • I have written and understand every part of this contribution myself - if AI tools were used, I have thoroughly reviewed and verified all changes
  • I have commented my code, particularly in hard-to-understand areas

Stack created with GitHub Stacks CLIGive Feedback 💬

@mating02 mating02 added the Refinement Required Need to be refined label Aug 7, 2026
@Planlos5000 Planlos5000 linked an issue Aug 7, 2026 that may be closed by this pull request
5 tasks
@Planlos5000 Planlos5000 added the feat This pull request or issue adds a new feature label Aug 7, 2026
@mating02
mating02 marked this pull request as ready for review August 10, 2026 12:22
@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from ab9ee48 to b93e843 Compare August 10, 2026 12:37
@mating02 mating02 added Review Needed This pull request is ready for review and removed Refinement Required Need to be refined labels Aug 10, 2026
Comment thread server/src/api/votings.go Outdated
Comment thread server/src/api/votings.go Outdated
Comment thread server/src/api/votings_test.go Outdated
Comment thread server/src/votings/database.go Outdated
Comment thread server/src/votings/api.go Outdated
Comment thread server/src/votings/service.go Outdated
Comment thread server/src/votings/voting_status.go Outdated
@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from b93e843 to 772d388 Compare August 12, 2026 12:03
@wischoepke

Copy link
Copy Markdown
Collaborator

I'd like to bring up a general point that caught my eye again in this PR. The OpenTelemetry stuff tends to clutter up the method quite a bit. Could you check if it makes sense to extract that into separate methods for your PR?

@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from 568dfa4 to fdd8eee Compare August 17, 2026 09:01
@github-actions

Copy link
Copy Markdown

The deployment to the dev cluster was successful. You can find the deployment here: https://6464.development.scrumlr.fra.ics.inovex.io
This deployment is only for testing purposes and will be deleted after 1 week.
To redeploy rerun the workflow.
DO NOT STORE IMPORTANT DATA ON THIS DEPLOYMENT

Deployed Images
  • ghcr.io/inovex/scrumlr.io/scrumlr-frontend:sha-e2ee0c2

  • ghcr.io/inovex/scrumlr.io/scrumlr-server:sha-e2ee0c2

Comment thread server/src/votings/dto.go
@@ -49,8 +49,9 @@ type VotingCreateRequest struct {

// VotingCloseRequest represents the request to update a voting session.
type VotingCloseRequest struct {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should rename this struct now to VotingUpdateRequest or something like this

Comment thread server/src/votings/api.go
AddVote(ctx context.Context, req VoteRequest) (*Vote, error)
RemoveVote(ctx context.Context, req VoteRequest) error
Close(ctx context.Context, id uuid.UUID, board uuid.UUID, affectedNotes []Note) (*Voting, error)
Update(ctx context.Context, id uuid.UUID, board uuid.UUID, affectedNotes []Note, votingStatus VotingStatus) (*Voting, error)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you think of changing the signature so that first the status is requested and then the notes?

}
}

func (service *Service) Update(ctx context.Context, id uuid.UUID, board uuid.UUID, affectedNotes []Note, votingStatus VotingStatus) (*Voting, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Public functions should be before private functions

)

// VotingStatus is the state of a voting session and can be one of open, aborted or closed.
// VotingStatus is the state of a voting session and can be one of open, canceled or closed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also change the comment to aborted

@Planlos5000

Copy link
Copy Markdown
Collaborator

The e2e tests need an update because the voting update now requires the status

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

Labels

feat This pull request or issue adds a new feature Review Needed This pull request is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel a voting

3 participants