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

User Authentication + functionality #1

Merged
merged 36 commits into from
Aug 25, 2023
Merged

Conversation

bilalrajput09
Copy link
Owner

@bilalrajput09 bilalrajput09 commented Aug 23, 2023

In The Dollar Dairy Budget App

The following were implemented:

Interactions

  • Splash screen
  • A simple page with the name of your app (yes, you need to choose one), and links to the sign up and log in pages.

Sign up and log in pages

  • The user should be able to register in the app with full name, email and password (all mandatory).
  • The user can log into the app using email and password.
  • If the user is not logged in, they can't access pages that require the user to be logged in (all the pages described below).

Home page (categories page)

  • When the user logs in, they are presented with the categories page.
  • For each category, the user can see their name, icon and the total amount of all the transactions that belongs to that category.
  • When the user clicks (or taps) on a category item, the application navigates to the transactions page for that category.
  • There is a button "add a new category" at the bottom that brings the user to the page to create a new category.

Transactions page

  • For a given category, the list of transactions is presented, ordered by the most recent.
  • At the top of the page the user could see the total amount for the category (sum of all of the amounts of the transactions in that category).
  • There is a button "add a new transaction" at the bottom that brings the user to the page to create a new transaction.
  • When the user clicks on the "Back" button (<), the user navigates to the home page.

Add a new category page

  • The user fills out a form to create a new category, indicating their name and icon (both mandatory).
  • The user clicks (or taps) the "Save" button to create the new category, and is taken to the home page on success.
  • When the user clicks on the "Back" button (<), the user navigates to the home page.

"Add a new transaction" page

  • The user fills out a form to create a new transaction with:
  • name (mandatory)
  • amount (mandatory)
  • categories (mandatory at least one)
  • The user click (or taps) the "Save" button to create the new transaction, and is taken to the transactions page for that category.
  • When the user clicks on the "Back" button (<), the user navigates to the transactions page for that category.

Testing requirements

  • Create unit and integration tests for all the most important components of your RoR application.

Technical requirements

  • You should use Postgres as your database.
  • You should use devise for authentication.
  • You should validate all user input to make sure that anyone with bad intentions cannot compromise your app.
  • You can use a view template engine of your choice (.erb, .slim, .haml).
  • The project should be deployed and accessible online.
  • Your database schema should reflect the following structure:

@bilalrajput09 bilalrajput09 changed the title User Authentication User Authentication + functionality Aug 23, 2023
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:25 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render August 24, 2023 18:34 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:34 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render August 24, 2023 18:35 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:35 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:37 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render August 24, 2023 18:37 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render August 24, 2023 18:38 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:38 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 24, 2023 18:44 — with Render Inactive
Copy link

@mckent05 mckent05 left a comment

Choose a reason for hiding this comment

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

Hi @bilalrajput09,

STATUS: CHANGES REQUIRED ♻️ ♻️

Good job so far!
There are some issues that you still need to work on to go to the next project but you are almost there!
almost there

Highlights

  • All linter checks are passing ✔️ ✔️
  • Your PR is professional 👍 👍
  • You have done well creating your budget application,

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

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 in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

Comment on lines 48 to 54
def category_params
params.permit(:name, :icon)
end

def spending_params
params.permit(:name, :amount)
end

Choose a reason for hiding this comment

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

  • You have done well so far, but in order to properly validate your input, I think you should use strong params. i.e params.require(:attribute_name).permit(:name, icon). Please fix this for both category_params and spending_params 😄

Comment on lines +13 to +14
spending = Spending.new(spending_params)
if current_user.spendings << spending

Choose a reason for hiding this comment

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

OPTIONAL - Good job done so far, but to make your code easier to read and implement the belongs-to relationship between spending and user i suggest you do:

spending = current_user.spending.new(spending_params)

Comment on lines +1 to +17
<%= render "spendings/spending_nav"%>


<div class="card text-bg-warning mb-4 mt-3 mx-auto d-flex flex-row" style="width: 30rem;">
<div class="card-body">
<h5 class="card-title"><%= @category.name %></h5>
</div>
<div class="card-body d-flex justify-content-end">
<h5 class="card-title">Total Spent: $<%= @total_spent %></h5>
</div>
</div>

<%= render @spendings %>



<%= render "categories/button_category_spendings"%>

Choose a reason for hiding this comment

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

  • You have done well so far, but according to the project requirements, to add a new transaction:
The user fills out a form to create a new transaction with:

* name (mandatory)
* amount (mandatory)
* categories (mandatory at least one)

I suggest you make it possible for the user to choose one or more category for the new transaction and not automatically the category that was clicked on. Please fix this 🙏

Choose a reason for hiding this comment

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

  • When I did not fill out any of the mandatory fields, it threw an error, this is not user-friendly at all, you can add a flash message telling the user to fill in the input missing, or simply do not allow submit of form when all fields are not filled
    Screenshot from 2023-08-25 11-38-09

Comment on lines +1 to +19
require 'rails_helper'

RSpec.describe 'Authentication', type: :request do
let(:user) { User.new(name: 'Bilal Ahmed', email: 'bilal@gmail.com', password: 'password') }

before do
sign_in user
end

it 'Should show categories for sign in users' do
get categories_path
expect(response).to have_http_status(:success)
end

it 'Should show new categories page' do
get new_category_path
expect(response).to have_http_status(:success)
end
end

Choose a reason for hiding this comment

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

  • Good job done so far, but you have not properly done your integration tests. Remember integration test should ensure that your rendered template contains the right information filled in from the database. Please fix this 👍. You can use this article as a reminder.

Comment on lines +1 to +19
require 'rails_helper'

RSpec.describe 'Authentication', type: :request do
let(:user) { User.new(name: 'Bilal Ahmed', email: 'bilal@gmail.com', password: 'password') }

before do
sign_in user
end

it 'Should show categories for sign in users' do
get categories_path
expect(response).to have_http_status(:success)
end

it 'Should show new categories page' do
get new_category_path
expect(response).to have_http_status(:success)
end
end

Choose a reason for hiding this comment

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

  • Good job done so far, but you have not properly done your integration tests. Remember integration test should ensure that your rendered template contains the right information filled in from the database. Please fix this 👍. You can use this article as a reminder.

README.md Outdated

### Video

<a href="#">Demonstration video</a>

Choose a reason for hiding this comment

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

  • According to the project requirements, your documentation should contain a video presentation, the presentation should contain the following:
1. The student recorded a video presenting the features of the project.
1. The maximum length of the video is 5 minutes.
1. The video contains a clear and objective description about the project in professional English. The topic and purpose of the project are made clear.
1. The video contains a demo of the project, highlighting all the project features.
1. The video contains a highlight about a piece of the code the student finds interesting or is proud of making.

> **Note:** It's recommended that students use [Loom](https://www.loom.com/) to record to video but they can use any tool they want as long as they share an online link of the uploaded video.

@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 25, 2023 07:35 — with Render Inactive
@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 25, 2023 10:01 — with Render Inactive
Copy link

@VICTOR-CHUKWU VICTOR-CHUKWU left a comment

Choose a reason for hiding this comment

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

Hi @bilalrajput09 ,

STATUS: CHANGES REQUIRED ♻️

Great work on making the changes 👏
You've done well implementing some of the requested changes, but there are still some which aren't addressed yet.

Suggested changes

Check the comments under the review.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.

Comment on lines +1 to +17
<%= render "spendings/spending_nav"%>


<div class="card text-bg-warning mb-4 mt-3 mx-auto d-flex flex-row" style="width: 30rem;">
<div class="card-body">
<h5 class="card-title"><%= @category.name %></h5>
</div>
<div class="card-body d-flex justify-content-end">
<h5 class="card-title">Total Spent: $<%= @total_spent %></h5>
</div>
</div>

<%= render @spendings %>



<%= render "categories/button_category_spendings"%>

Choose a reason for hiding this comment

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

  • When I did not fill out any of the mandatory fields, it threw an error, this is not user-friendly at all, you can add a flash message telling the user to fill in the input missing, or simply do not allow submit of form when all fields are not filled
    Screenshot from 2023-08-25 11-38-09

@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 25, 2023 11:47 — with Render Inactive
Copy link

@mukhammadrizooff mukhammadrizooff left a comment

Choose a reason for hiding this comment

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

Hi @bilalrajput09,

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

Highlights

  • No linter errors ✔️
  • Correct GitFlow ✔️
  • Good implementations ✔️
  • Descriptive README file ✔️

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

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 in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@bilalrajput09 bilalrajput09 temporarily deployed to user_authentication - budget_app_render-jjqs August 25, 2023 12:30 — with Render Inactive
@bilalrajput09 bilalrajput09 merged commit 3ad9a77 into dev Aug 25, 2023
1 check passed
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.

None yet

4 participants