Fix summarizing vote results

This commit is contained in:
Jan Dittberner 2023-05-12 17:51:42 +02:00
parent f27f2bf801
commit 12796486d2

View file

@ -458,13 +458,15 @@ func sumsForDecision(ctx context.Context, tx *sqlx.Tx, d *Motion) (*VoteSums, er
return nil, fmt.Errorf("could not parse row for vote sums of motion %s: %w", d.Tag, err) return nil, fmt.Errorf("could not parse row for vote sums of motion %s: %w", d.Tag, err)
} }
switch vote { switch vote.ID {
case VoteAye: case VoteAye.ID:
sums.Ayes = count sums.Ayes = count
case VoteNaye: case VoteNaye.ID:
sums.Nayes = count sums.Nayes = count
case VoteAbstain: case VoteAbstain.ID:
sums.Abstains = count sums.Abstains = count
default:
return nil, fmt.Errorf("unknown vote type '%+v'", vote)
} }
} }