Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Имаев Альберт #20

Closed
wants to merge 2 commits into from
Closed

Conversation

Morkhod
Copy link

@Morkhod Morkhod commented Apr 23, 2018

No description provided.

@honest-hrundel honest-hrundel changed the title first attempt Имаев Альберт Apr 23, 2018
@honest-hrundel
Copy link

🍏 Пройден линтинг и базовые тесты

Copy link

@nex2hex nex2hex left a comment

Choose a reason for hiding this comment

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

🍅
но в целом все хоршо

queries.js Outdated
}

getCheapSouvenirs(price) {
// Данный метод должен возвращать все сувениры, цена которых меньше или равна price.
return this.Souvenir.findAll({
where: {
price: { [this.Op.lt]: price }
Copy link

Choose a reason for hiding this comment

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

цена должна мыть меньше или равна

primaryKey: true,
autoIncrement: true
},
name: {
Copy link

Choose a reason for hiding this comment

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

кажется, что тут нужен индекс (в коде есть выборка по тэгу)

autoIncrement: true
},
login: {
type: DataTypes.TEXT
Copy link

Choose a reason for hiding this comment

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

и тут индекс, уникальный (не может быть двух юзеров с одинаковым логином)

queries.js Outdated
attributes: ['id', 'name', 'image', 'price', 'rating'],
include: {
model: this.Tag,
where: { name: tag },
Copy link

Choose a reason for hiding this comment

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

сравнение лучше делать регистронезависимым

queries.js Outdated
},
include: [{
model: this.Country,
where: { name: country },
Copy link

Choose a reason for hiding this comment

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

и тут регистронезависимый

await souvenir.createReview(review, { transaction });

const reviews = await souvenir.getReviews({ transaction });
rating = (souvenir.rating * (reviews.length - 1) + rating) / (reviews.length);
Copy link

Choose a reason for hiding this comment

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

не обязательно к исправлению

сейчас ты загружаешь в приложение весь список отзывов и обновляешь рейтинг
Такие вычисления лучше делать на стороне БД

queries.js Outdated
},
{
model: this.User,
where: { login }
Copy link

Choose a reason for hiding this comment

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

тут тоже лучше регистронезависимое сравнение

@honest-hrundel
Copy link

🍏 Пройден линтинг и базовые тесты

@nex2hex
Copy link

nex2hex commented Apr 25, 2018

🍏

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

Successfully merging this pull request may close these issues.

3 participants