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

fix: fix the actions of votes when different events are triggered #4616

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
21 changes: 19 additions & 2 deletions server/src/api/event_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import (
"encoding/json"

"github.com/google/uuid"
"scrumlr.io/server/common/dto"
"scrumlr.io/server/database/types"
Expand Down Expand Up @@ -312,6 +311,24 @@

func eventInitFilter(event InitEvent, clientID uuid.UUID) InitEvent {
isMod := isModerator(clientID, event.Data.BoardSessions)

// filter to only respond with the latest voting and its votes
latestVoting := event.Data.Votings

Check failure on line 316 in server/src/api/event_filter.go

View workflow job for this annotation

GitHub Actions / Build and Test – Backend

ineffectual assignment to latestVoting (ineffassign)
if len(event.Data.Votings) != 0 {
latestVoting = make([]*dto.Voting, 0)
activeNotes := make([]*dto.Vote, 0)

latestVoting = append(latestVoting, event.Data.Votings[0])

for _, v := range event.Data.Votes {
if v.Voting == latestVoting[0].ID {
activeNotes = append(activeNotes, v)
}
}
event.Data.Votings = latestVoting
event.Data.Votes = activeNotes
}

if isMod {
return event
}
Expand All @@ -329,9 +346,9 @@
Votes: event.Data.Votes,
},
}

// Columns
filteredColumns := filterColumns(event.Data.Columns)

// Notes
filteredNotes := filterNotes(event.Data.Notes, clientID, event.Data.Board, event.Data.Columns)

Expand Down
Loading
Loading