Skip to content

done#1234

Open
chupa-ilona wants to merge 4 commits into
mate-academy:masterfrom
chupa-ilona:master
Open

done#1234
chupa-ilona wants to merge 4 commits into
mate-academy:masterfrom
chupa-ilona:master

Conversation

@chupa-ilona
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Good job setting up the logger and configuring the .gitignore file. However, this requires changes before it can be approved. The main issues are that several explicit checklist requirements were missed, and the build is failing.

Here's what you need to fix:

  1. Remove TODO comments: All TODO comments must be removed from AuthenticationServiceImpl.java and OrderServiceImpl.java before submission. [CHECKLIST ITEM #1]
  2. Make log messages informative: The log messages should include method parameters to be useful for debugging. For example, in the login method, change the log to something like logger.info("Method login was called. Params: login={}", login);. [CHECKLIST ITEM #3]
  3. Fix Checkstyle issues: The build is failing due to style violations. Please make the logger fields private in both service classes and add a blank line after their declarations.

Once these issues are addressed, your solution will be ready for another review.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Logger logger = getLogger(AuthenticationServiceImpl.class);
@Override
public User login(String login, String password) throws AuthenticationException {
//TODO: add corresponding log message about method login was called
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This TODO comment should be removed. According to checklist item #1, all TODO comments must be removed before submitting the solution.

@Override
public User login(String login, String password) throws AuthenticationException {
//TODO: add corresponding log message about method login was called
logger.info("Method login was called");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This log message is not informative enough. As per checklist item #3, it's better to include method parameters to provide more context. For example: logger.info("Method login was called. Params: login={}", login);.

Logger logger = LogManager.getLogger();
@Override
public Order completeOrder(Long userId) {
// TODO: add log message about method completeOrder was called
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This TODO comment should be removed as per checklist item #1: 'Let's remove all TODO comments before submitting solution.'

@Override
public Order completeOrder(Long userId) {
// TODO: add log message about method completeOrder was called
logger.info("Method completeOrder was called");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This log message violates checklist item #3: 'Let's make our log messages informative'. It should include the method parameters to be more useful. For example: logger.info("Method completeOrder was called for userId={}", userId);

@@ -25,6 +29,7 @@ private List<Product> getAllProductsFromShoppingCart(Long userId) {
Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This TODO comment should be removed as required by checklist item #1.

Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
logger.info("Successfully fetched data from DB");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This log message is not informative enough, which violates checklist item #3. Please include the userId to provide more context about which user's data was fetched.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great job addressing most of the previous feedback, like making the loggers private and removing the TODOs! We're very close to the finish line, but a few changes are still needed to meet all the requirements.

The main issue is that the log messages still use string concatenation. Please update them to use parameterized placeholders ({}) as required by the checklist [CHECKLIST ITEM #3]. For example, logger.info("Method completeOrder was called with userId: " + userId) should be logger.info("Method completeOrder was called with userId: {}", userId);.

Additionally, please fix the code style issues: add a blank line after the logger field declaration in the service classes and ensure there's an empty line at the end of the .gitignore file [CHECKLIST ITEM #2]. The build is also failing due to an unused import in AuthenticationServiceImpl.java that needs to be removed.

Once these points are addressed, your solution will be ready!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

import org.apache.logging.log4j.Logger;

public class OrderServiceImpl implements OrderService {
private Logger logger = LogManager.getLogger(OrderServiceImpl.class);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be a blank line after this field declaration to improve code readability. This was also mentioned in the previous review feedback.

@Override
public Order completeOrder(Long userId) {
// TODO: add log message about method completeOrder was called
logger.info("Method completeOrder was called with userId: " + userId + "");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #3: 'Let's make our log messages informative'. It's better to use parameterized logging for performance and readability, like this:

logger.info("Method completeOrder was called with userId: {}", userId);

Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
logger.info("Successfully fetched data from DB");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #3: 'Let's make our log messages informative'. This log message would be more useful if it included the userId for which the products are being fetched. For example: logger.info("Successfully fetched data from DB for userId: {}", userId);

//TODO: add corresponding log message about method login was called
logger.info("Method login was called with login: " + login + "");
User user = findByLogin(login);
if (!user.getPassword().equals(password)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is an improvement, but it's still not quite right. According to checklist item #3, you should use parameterized logging for better performance and readability. Instead of string concatenation, use placeholders like this: logger.info("Method login was called. Params: login={}", login);

Comment thread .gitignore
Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! You've done a fantastic job addressing the previous feedback, especially with updating all log messages to use parameterized placeholders. I am approving your solution so you can continue progressing. There is just one minor style issue to keep in mind for future tasks: please ensure all files end with a single empty line. In this case, AuthenticationServiceImpl.java and OrderServiceImpl.java were missing it. This is a common convention that improves code consistency [CHECKLIST ITEM #2]. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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.

2 participants