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

Issue #13 🎫: Food list and form #19

Merged
merged 12 commits into from
Dec 20, 2023
Merged

Conversation

ITurres
Copy link
Collaborator

@ITurres ITurres commented Dec 19, 2023

Pull Request Summary for Issue #13 Completion

Added:

  • None.

Modified:

/app/controllers/foods_controller.rb

  • I have modified the food#index action to load all foods from db that belong to the current user.
  • I have modified the food#create action to assigned the current user to the food being created.
  • Additionally I have replace the notice message with a flash message.

/app/models/food.rb

  • Validations to all attributes have been added.
  • I have also added a new method total_price to calculate the total price of the food based on the quantity and price.

/app/views/foods/_food.html.erb

  • Now the food partial will be render a table row with the food attributes and a button to delete the food.

/app/views/foods/_form.html.erb

  • I have added Bootstrap classes to the form and the form fields.
  • In addition to the form fields I have added a new hidden field to store the current user id.
  • Added Bootstrap and a new name to the submit button.

/app/views/foods/index.html.erb

  • The index page will render a table with all the foods that belong to the current user.
  • And the button to create a new food item.

/app/views/foods/new.html.erb

  • The new page will render the form to create a new food item.
  • This form has been refactored with Bootstrap classes and a new layout.

/app/views/layouts/application.html.erb

  • Replace the notice messages with flash messages.
  • Wrapped the yield with a container main.
  • Fix indentation.

/spec/factories/foods.rb

  • I have required the faker gem to generate fake data.
  • and populate the user attribute with the user factory.

/spec/factories/users.rb

  • I have required the faker gem to generate fake data.
  • Added a confirmed_at attribute to the user factory to avoid the unconfirmed user error when creating a new food item and testing.

/spec/models/food_spec.rb

  • I have added tests to validate the presence of all attributes.
  • Tests for correct and incorrect values for all attributes.

/spec/views/foods/index.html.erb_spec.rb

  • I have added integration tests to validate the foods#index view.

Thank you for reviewing this PR. Feel free to reach out on Slack as Arturo (Arthur) Emanuel Guerra Iturres for any queries or further assistance. 🌟

@ITurres ITurres added enhancement New feature or request Tests Unit Test and Integration Test UI Views and Interfaces labels Dec 19, 2023
@ITurres ITurres self-assigned this Dec 19, 2023
@ITurres ITurres linked an issue Dec 19, 2023 that may be closed by this pull request
Copy link
Owner

@demesameneshoa demesameneshoa left a comment

Choose a reason for hiding this comment

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

STATUS: APPROVED 🟢

Hi @ITurres 👋,

Your ticket 🎫 is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

To Highlight 🎉

  • Good job with Food View and Controller. ✔️
  • Good job using partials. ✔️
  • No linter errors. ✔️
  • PR has a good title and summary. ✔️

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear. Please, remember to tag me with @demesameneshoa in your question so I can receive the notification.

@demesameneshoa demesameneshoa merged commit 563637c into dev Dec 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Tests Unit Test and Integration Test UI Views and Interfaces
Projects
Development

Successfully merging this pull request may close these issues.

[3pt] - Food List - Path: //foods
2 participants