-
Notifications
You must be signed in to change notification settings - Fork 0
этап 3 #3
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
base: main
Are you sure you want to change the base?
этап 3 #3
Conversation
ErkinKasymaliev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
привет, оставил комменты
| @Setter | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class Mark { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше Rate - семантически вернее будет, следовательно надо везде поменять RateService, RateRepo ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправлено
| @Transactional | ||
| public void deleteMark(int userId, int eventId) { | ||
| Mark mark = markRepository.findOneByEvaluator_IdAndEvent_Id(userId, eventId); | ||
| ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лишнее
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Убрал
| public void deleteMark(int userId, int eventId) { | ||
| Mark mark = markRepository.findOneByEvaluator_IdAndEvent_Id(userId, eventId); | ||
| ; | ||
| if (mark != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (mark == null) {
return;
}
Event event = eventService.getEvent(eventId);
User initiator = userService.getUser(event.getInitiator().getId());
...
main-service/src/main/java/ru/practicum/mainservice/model/mark/Mark.java
Outdated
Show resolved
Hide resolved
| @Transactional | ||
| public void putMark(int userId, int eventId, Boolean score) { | ||
| Mark mark = markRepository.findOneByEvaluator_IdAndEvent_Id(userId, eventId); | ||
| ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лишнее
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Убрал
| initiator.setRating(initiator.getRating() + Constants.CHANGING_RATING_WHEN_CHANGING_MARK); | ||
| } | ||
| mark.setScore(score); | ||
| eventService.save(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventService.save(event);
markRepository.save(mark);
userService.saveUser(initiator);
это дублируется в else.
давайте вынесем за if-else в конец метода
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправлено
ErkinKasymaliev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поправьте комменты (они стилистические) и можете мержить.
Работа принята!
Поздравляю вас с окончанием курса! Скорейшего вам выхода на коммерческую разработку и стремительного роста!
| } | ||
|
|
||
| @Transactional | ||
| public void putMark(int userId, int eventId, Boolean score) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putRate
| } | ||
|
|
||
| @Transactional | ||
| public void deleteMark(int userId, int eventId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteRate
| public void putMark(int userId, int eventId, Boolean score) { | ||
| Mark mark = markRepository.findOneByEvaluator_IdAndEvent_Id(userId, eventId); | ||
| ; | ||
| Rate mark = rateRepository.findOneByEvaluator_IdAndEvent_Id(userId, eventId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate rate уберите отовсюду mark
No description provided.