Михайловский Евгений#12
Hidden character warning
Conversation
| cards?: Array<ICard>; | ||
| } | ||
|
|
||
| export class BankOffice { |
src/task_2/index.ts
Outdated
| public authorize(userId: any, cardId: any, cardPin: any): any { | ||
|
|
||
| public authorize(userId: string, cardId: string, cardPin: string): boolean { | ||
| for (let users of this._users) { |
There was a problem hiding this comment.
this_users - должен быть коллекций, а он одиночный объект, по этому ошибка.
src/task_3/index.ts
Outdated
|
|
||
| private changeUserName(newName: any): any { | ||
|
|
||
| private changeUserName(newName: String): boolean { |
src/task_4/index.ts
Outdated
| moneyUnits.forEach(x => amount += x.count * Number(x.moneyInfo.denomination)); | ||
| let fromRub = fromCurrency === Currency.RUB; | ||
| let money = fromRub ? (amount - amount % 70) / 70 : Math.floor(amount) * 70; | ||
| return this._moneyRepository.convertMoney(money, fromRub ? Currency.USD : Currency.RUB, moneyUnits); |
src/task_5/index.ts
Outdated
| if(!this._bankOffice.authorize(user.id, card.id, cardPin)) return false; | ||
| { | ||
| this._authorizedUser = user; | ||
| this._usersCard = card; |
src/task_4/index.ts
Outdated
| let fromRub = fromCurrency === Currency.RUB; | ||
| let money = fromRub ? (amount - amount % 70) / 70 : Math.floor(amount) * 70; | ||
| return this._moneyRepository.convertMoney(money, fromRub ? Currency.USD : Currency.RUB, moneyUnits); | ||
|
|
src/task_3/index.ts
Outdated
| } else { | ||
| return this.registerForUserNewCard(argsForChangeFunction); | ||
| } | ||
|
|
src/task_2/index.ts
Outdated
| } | ||
| } | ||
| return false; | ||
|
|
src/task_1/index.ts
Outdated
| this._repository.forEach(point =>{ | ||
| for (let pin in point) { | ||
|
|
||
| if (point[currency] === currency && counter >= point[count]) { |
There was a problem hiding this comment.
У объекта point Нет поля currency - это не будет работать.
К тому же тут нужно было сделать жадный алгоритм
|
|
||
| public takeMoney(moneyUnits: IMoneyUnit): void { | ||
| this._repository.push(moneyUnits); | ||
| } |
There was a problem hiding this comment.
Посмотрите, я исправил решение
There was a problem hiding this comment.
Метод теперь работает верно 2 бала
|
Теперь за всё задание 7 балов у тебя |
|
|
||
| public convertMoneyUnits(fromCurrency: Currency, toCurrency: Currency, moneyUnits: any): any { | ||
|
|
||
| public convertMoneyUnits(fromCurrency: Currency, toCurrency: Currency, moneyUnits: IMoneyUnit[]): IMoneyUnit[] { |
There was a problem hiding this comment.
Этот метод не может возвращать массив купюр к выдаче. Потому что купюра не может быть дробной. Этот метод должен возвращать сумму, которая передаётся в _moneyRepository
| public giveOutUsersMoney(count: number) { | ||
| if (this._authorizedUser) | ||
| { | ||
| this._moneyRepository.giveOutMoney(count, this._card.currency); |
There was a problem hiding this comment.
Добавь уменьшение денег на авторизованной карте. Изменение баланса карты
| else if (option === UserSettingOptions.newCard) | ||
| return this.registerForUserNewCard(argsForChangeFunction); | ||
| } | ||
| } No newline at end of file |
|
|
||
| public isCardTiedToUser(cardId: string): boolean { | ||
| return this._users.filter(x=> x.cards.find(y=> y.id === cardId)).length > 0; | ||
| } |
|
|
||
| public takeMoney(moneyUnits: IMoneyUnit): void { | ||
| this._repository.push(moneyUnits); | ||
| } |
There was a problem hiding this comment.
Метод теперь работает верно 2 бала
No description provided.