Skip to content

Commit daab68d

Browse files
committed
Fix grouped voter names
1 parent 92b8343 commit daab68d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

backend/src/pokers/pokers.gateway.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { OnGatewayInit, SubscribeMessage, WebSocketGateway, WebSocketServer } fr
22
import { Server, Socket } from "socket.io";
33
import { PointsService } from "../points/points.service";
44
import { Member, Story, Vote, VoteValue } from "./poker-room";
5-
import { PokersService, MemberGroups, GroupVoteName } from "./pokers.service";
5+
import { PokersService, MemberGroups, GroupVoteNames } from "./pokers.service";
66

77
interface VoteResponse {
88
voterName: string;
@@ -13,7 +13,7 @@ interface VoteResponse {
1313
interface VotesResponse {
1414
votes: VoteResponse[];
1515
voteCount: number;
16-
groupedVoterNames: GroupVoteName[];
16+
groupedVoterNames: GroupVoteNames;
1717
votedNames: string[];
1818
voteAverage?: number | string;
1919
nearestPointAverage?: VoteValue;

backend/src/pokers/pokers.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { Socket } from "socket.io";
33
import { PointsService } from "../points/points.service";
44
import { Member, PokerRoom, Story, Vote } from "./poker-room";
55

6-
export interface GroupVoteName {
6+
export interface GroupVoteNames {
77
[ group: string ]: string[];
88
}
99

1010
interface CurrentVotes {
1111
voteCount: number;
1212
votes: Vote[];
13-
groupedVoterNames: GroupVoteName[];
13+
groupedVoterNames: GroupVoteNames;
1414
}
1515

1616
export interface Rooms {
@@ -285,13 +285,13 @@ export class PokersService {
285285
const room: PokerRoom = this.getRoom( poker );
286286
const voted: Member[] = room.getVotedClients();
287287
const votes = room.getCurrentVotes();
288-
const groupedVoterNames: GroupVoteName[] = voted.reduce( ( accumulator, member: Member ) => {
288+
const groupedVoterNames: GroupVoteNames = voted.reduce( ( accumulator, member: Member ) => {
289289
const vote = room.getCurrentVote( member.id );
290290
const voteGroupKey: string = vote.initialValue + "/" + vote.currentValue;
291291
accumulator[ voteGroupKey ] = accumulator[ voteGroupKey ] || [];
292292
accumulator[ voteGroupKey ].push( member.name );
293293
return accumulator;
294-
}, [] );
294+
}, {} );
295295

296296
return {
297297
voteCount: voted.length,

0 commit comments

Comments
 (0)