Skip to content

Commit

Permalink
Changed assignRole as a method
Browse files Browse the repository at this point in the history
  • Loading branch information
anshulrastogi9 committed Nov 14, 2024
1 parent 7d6c2c8 commit 2a3fb55
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/models/pokerTable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,11 @@ class PokerTable extends BaseEventEmitter implements PokerTableInterface {
return false;
}

private __assignRoles(event: BaseEventInterface,next: () => void): void | false {
public assignRoles(event: BaseEventInterface): void | false {
this.__assignRoles(event);
}

private __assignRoles(event: BaseEventInterface): void | false {

if (event.occupancyCount === 2) {
let foundDealer = false;
Expand Down Expand Up @@ -741,9 +745,15 @@ class PokerTable extends BaseEventEmitter implements PokerTableInterface {
}
}
}
next();
}

private __assignRolesMiddleware(event: BaseEventInterface,next: () => void): void | false {

return this.__assignRoles(event);
next();
}


/**
* #### Description
* Checks seat availability to determine if it can be occupied by a player.
Expand Down Expand Up @@ -891,7 +901,7 @@ class PokerTable extends BaseEventEmitter implements PokerTableInterface {
this.__checkOccupancyCount(event, next);
},
(event, next) => {
this.__assignRoles(event, next);
this.__assignRolesMiddleware(event, next);
},
(event, next) => {
this.__validatePlayerBalances(event, next);
Expand All @@ -917,7 +927,7 @@ class PokerTable extends BaseEventEmitter implements PokerTableInterface {
this.__checkOccupancyCount(event, next);
},
(event, next) => {
this.__assignRoles(event, next);
this.__assignRolesMiddleware(event, next);
},
(event, next) => {
this.__validatePlayerBalances(event, next);
Expand Down

0 comments on commit 2a3fb55

Please sign in to comment.