Skip to content

Commit

Permalink
Pass story to method
Browse files Browse the repository at this point in the history
  • Loading branch information
moorscode committed Feb 13, 2021
1 parent 375fcee commit 89fa201
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions backend/src/pokers/poker-room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class PokerRoom {
}

public recalculateStory() {
this.currentStory = this.setStoryAverage();
this.currentStory = this.setStoryAverage( this.currentStory );
this.currentStory.votesRevealed = false;
this.currentStory.voters = this.getVoterCount();
}
Expand Down Expand Up @@ -288,7 +288,7 @@ export class PokerRoom {
};

this.currentStory.votes.push( vote );
this.currentStory = this.setStoryAverage();
this.currentStory = this.setStoryAverage( this.currentStory );
}

/**
Expand All @@ -308,7 +308,7 @@ export class PokerRoom {
}
this.getCurrentVote( memberId ).currentValue = vote;

this.currentStory = this.setStoryAverage();
this.currentStory = this.setStoryAverage( this.currentStory );
}

/**
Expand All @@ -318,7 +318,7 @@ export class PokerRoom {
*
* @returns {boolean} True if every client has voted.
*/
private hasEverybodyVoted( story: Story ): boolean {
private hasAllVotes( story: Story ): boolean {
return story.votes.length === this.getVoterCount();
}

Expand Down Expand Up @@ -410,11 +410,10 @@ export class PokerRoom {
*
* @returns {Story} The adjusted story.
*/
public setStoryAverage(): Story {
const story = this.getCurrentStory();

public setStoryAverage( story: Story ): Story {
if ( story.votes.length === 0 ) {
delete story.voteAverage;
delete story.nearestPointAverage;
return story;
}

Expand Down

0 comments on commit 89fa201

Please sign in to comment.