Skip to content

Commit

Permalink
BW-681 #comment code suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
piya99 committed Jan 30, 2020
1 parent 55f55b4 commit 998df4b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions functions/controllers/scheduler.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ export class SchedulerController {
}
}

/* checkGameInvitationExpire
/* checkGameInvitationIsExpired
* return status
*/
static async checkGameInvitationExpire(req, res) {
static async checkGameInvitationIsExpired(req, res) {
try {
await GameMechanics.checkGameInvitationExpire();
await GameMechanics.checkGameInvitationIsExpired();
Utils.sendResponse(res, interceptorConstants.SUCCESS,
ResponseMessagesConstants.SCHEDULER_CHECK_GAME_INVITATION_EXPIRE_IS_COMPLETED);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion functions/routes/scheduler-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SchedulerRoutes {

// '/game-invitation-expire'
this.schedulerRoutes.post(`/${RoutesConstants.GAME_DASH_INVITATION_DASH_EXPIRE}`,
AuthMiddleware.authTokenOnly, SchedulerController.checkGameInvitationExpire);
AuthMiddleware.authTokenOnly, SchedulerController.checkGameInvitationIsExpired);

}
}
Expand Down
8 changes: 4 additions & 4 deletions functions/services/game.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ export class GameService {
}

/**
* GetAllLaggedGames
* getAllGameForReminder
* return status
*/
static async getAllLaggedGames(timeStamp: number, type: string, gameStatus = []): Promise<any> {
static async getAllGameForReminder(timeStamp: number, type: string, gameStatus = []): Promise<any> {
try {
if (gameStatus.length > 0) {
return GameService.getGames(
Expand Down Expand Up @@ -202,13 +202,13 @@ export class GameService {
* GetAllExpiredGames
* return status
*/
static async getAllExpiredGames(timeStamp: number, type: string[]): Promise<any> {
static async getAllExpiredGames(timeStamp: number, gameStatus: string[]): Promise<any> {
try {
return GameService.getGames(
await GameService.gameFireStoreClient
.collection(`/${CollectionConstants.GAMES}`)
.where(GameConstants.GAME_OVER, GeneralConstants.DOUBLE_EQUAL, false)
.where(GameConstants.GAME_STATUS , GeneralConstants.IN , type)
.where(GameConstants.GAME_STATUS , GeneralConstants.IN , gameStatus)
.where(GameConstants.TURN_AT, GeneralConstants.LESS_THAN_OR_EQUAL, timeStamp)
.get()
);
Expand Down
4 changes: 2 additions & 2 deletions functions/utils/game-mechanics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class GameMechanics {
}


static async checkGameInvitationExpire(): Promise<boolean> {
static async checkGameInvitationIsExpired(): Promise<boolean> {
try {
const millis = Utils.getUTCTimeStamp();
const noPlayTime = (CalenderConstants.HOURS_CALCULATIONS * schedulerConstants.gameInvitationDuration);
Expand Down Expand Up @@ -139,7 +139,7 @@ export class GameMechanics {
const millis = Utils.getUTCTimeStamp();
const noPlayTime = (CalenderConstants.HOURS_CALCULATIONS * schedulerConstants.gamePlayLagDuration);
const notificationDuration = millis - ( noPlayTime - (timeBefore * 60 * 1000));
const games: Game[] = await GameService.getAllLaggedGames(notificationDuration, type, gameStatus);
const games: Game[] = await GameService.getAllGameForReminder(notificationDuration, type, gameStatus);
for (const game of games) {
if (game.gameId) {
PushNotification.sendGamePlayPushNotifications(game,
Expand Down

0 comments on commit 998df4b

Please sign in to comment.