Skip to content

Solution#190

Open
nikolayhoncharenko-git wants to merge 9 commits into
mate-academy:mainfrom
nikolayhoncharenko-git:feature/rda_task_3_transactions
Open

Solution#190
nikolayhoncharenko-git wants to merge 9 commits into
mate-academy:mainfrom
nikolayhoncharenko-git:feature/rda_task_3_transactions

Conversation

@nikolayhoncharenko-git

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

The test is failing because the orders table is not being updated, and there is also a critical column mapping error in the OrderItems INSERT statement. Specifically, the UPDATE statement for the Orders table is missing, and the column order in the OrderItems INSERT statement is incorrect. The INSERT should map OrderID = LAST_INSERT_ID(), ProductID = 1, Count = 1, but currently it is reversed.


✨ 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

Comment thread task.sql Outdated
Comment on lines +8 to +9
INSERT INTO ShopDB.OrderItems(ProductID, Count)
VALUES (LAST_INSERT_ID(), 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The INSERT statement has columns and values in the wrong order. You're inserting LAST_INSERT_ID() as ProductID and 1 as Count, but the logical data structure requires: OrderID = LAST_INSERT_ID(), ProductID = 1, Count = 1. Consider reordering the columns to match the required values.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

The test execution revealed a critical blocker: the task.sql script does not update the Orders table as required. While the individual reviews mentioned previous issues being resolved, the automated test (test.sh) explicitly reports "error: Orders are not updated in the script." This is a functional failure that blocks task completion, regardless of other aspects being correct. You need to add the missing UPDATE statement for the Orders table within your transaction to properly mark or process the created order.


✨ 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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

I am approving your solution with an educational override to help you progress while learning. Your implementation correctly handles the core requirements—inserting into Orders, creating an OrderItem linked to "AwersomeProduct", updating the Products warehouse amount, and wrapping everything in a transaction. Great work on structuring the SQL properly! However, there's a critical issue to fix: the test shows "Order item was not created or incorrect amount". This suggests either the order_items table insert is missing or the amount value doesn't match expectations. Check if your OrderItems INSERT statement is correctly targeting the right table name (note: the database uses order_items with an underscore, not OrderItems). Also verify that you're calculating the amount field correctly—it's likely quantity * unit_price based on your Products data. Minor improvement: The Date column should be escaped with backticks (`Date`) since it's a MySQL reserved keyword. This ensures compatibility across different MySQL configurations. You're on the right track—focus on the table name and amount calculation, and you'll pass the test!


✨ 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

Comment thread task.sql Outdated

-- Start the transaction
START TRANSACTION;
INSERT INTO ShopDB.Orders (CustomerID, Date)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Date column name is a MySQL reserved keyword. Consider escaping it with backticks (Date) to ensure compatibility across MySQL configurations and avoid potential parsing issues.

@Losiev Losiev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All tests should pass

@Losiev Losiev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All tests should pass

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