Skip to content

Conversation

@PavelShershnoyv
Copy link

No description provided.

@sadyan42 sadyan42 assigned ievdokim and unassigned sadyan42 Nov 8, 2021
Copy link

@ievdokim ievdokim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Небольшие вопросики по 1 и 3 заданию.

public takeMoney(moneyUnits: IMoneyUnit[]): boolean {
for (let j = 0; j< moneyUnits.length; j++){
let canTake: boolean;
for (let i = 0; i < this._repository.length; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше всего использовать find

}
}
if (!canTake){
this._repository.push({ moneyInfo: { denomination: moneyUnits[j].moneyInfo.denomination,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не совсем понял, почему нельзя было просто this._repository.push(moneyUnits[j])

public isCardTiedToUser(cardId: string): boolean {
return this._users.find(user => user.cards.find(
card => card.id === cardId)) !== undefined;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачёт. 2 бала

private changeUserName(newName: any): any {
private changeUserName(newName: string): boolean {
if (this._user !== null && this._user !== undefined) {
if (this._user.name !== newName) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему эту условие нельзя поднять выше и не плодить if ?

аналогичный вопрос ко всем методам.

case Currency.USD:
return Number(moneyUnits.moneyInfo.denomination) * moneyUnits.count * 70;
case Currency.RUB:
return Number(moneyUnits.moneyInfo.denomination) * moneyUnits.count / 70;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачёт. 2 бала

}

public convertMoneyUnits(fromCurrency: Currency, toCurrency: Currency, moneyUnits: IMoneyUnit): number {
return this._currencyConverterModule.convertMoneyUnits(fromCurrency, toCurrency, moneyUnits);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачёт. 2 бала

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants