This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ItemCalendar { | |
startDay: number | |
finishDay: number | |
itemsPerDay: number | |
} | |
function calcItemsUsedBetweenDaysTs({ startDay, finishDay, itemsPerDay }: ItemCalendar) { | |
return (finishDay - startDay) * itemsPerDay; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deleteStaleSpecials() { | |
return from(this.specials.filter(({ stale }) => stale)).pipe( | |
mergeMap(special => | |
from(this.deleteSpecial(special)).pipe( | |
catchError(e => of(e)) | |
) | |
) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deleteStaleSpecials() { | |
const specialsDeletionStatus = Promise.allSettled( | |
this.specials | |
.filter(({ stale }) => stale) | |
.map((special) => this.deleteSpecial(special)) | |
); | |
const rejectedCheckPredicate = ({ status }) => status === 'rejected'; | |
if (specialsDeletionStatus.some(rejectedCheckPredicate) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class SpecialsService { | |
specials: Special[] = []; | |
... | |
deleteStaleSpecials() { | |
return Promise.all( | |
this.specials.map(async (special) => { | |
if (special.stale) { | |
await this.deleteSpecial(special); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class SpecialsService { | |
specials: [Special] = [{} as Special]; | |
... | |
async deleteStaleSpecials() { | |
try { | |
this.specials.forEach(async (special) => { | |
if (special.stale) { | |
await this.deleteSpecial(special); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ProfilePage { | |
... | |
shouldTriggerAppOpen = false; | |
gameUrl = from(this.userService.getUserId()).pipe( | |
mergeMap( | |
({ token: userIdToken } = { token = '' }) => | |
this.gameService.buildUrl(userIdToken) | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(...) | |
export class ProfilePage { | |
... | |
async openGameApp() { | |
try { | |
const { token: userIdToken } = { token: '' } = await this.userService.getUserId(); | |
Browser.open( | |
await lastValueFrom( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GAME_FORMAT = '/#{sessionId}/game/format'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GAME_WEB_FORMAT_URL = '/#{sessionId}/game/format'; | |
export const GAME_WEB_APP_URL = 'https://qa.game.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateEmail(email: string) { | |
- return Promise.resolve(validate(email.trim())); | |
+ return validate(email.trim()); |
NewerOlder