diff --git a/internal/models/motions.go b/internal/models/motions.go index 1c606bf..d5e76af 100644 --- a/internal/models/motions.go +++ b/internal/models/motions.go @@ -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) } - switch vote { - case VoteAye: + switch vote.ID { + case VoteAye.ID: sums.Ayes = count - case VoteNaye: + case VoteNaye.ID: sums.Nayes = count - case VoteAbstain: + case VoteAbstain.ID: sums.Abstains = count + default: + return nil, fmt.Errorf("unknown vote type '%+v'", vote) } }