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
Add ability to perform other expense operations #10
Commits on Oct 23, 2015
-
Creates an expense in an idiomatically correct way
- A new expense is created based on the association it has with a user
-
Allows a user to see a list of expenses via datatables
For loading all a user’s expenses we use the datatables gem via https://rails-assets.org/ because they help one better manage front end related dependencies. As part of installing the rails assets datatables gem, rails-assets-jquery gem also gets installed. With this we remove the rails-query gem(to avoid having two duplicate gems serve the same purpose) and we also add the unobtrusive scripting adapter for jQuery namely jquery-ujs via rails-assets.org Other important points to note as part of this commit include: - A user logged into the system would see their expenses in the order of the most recently made expense(based on the actual expense date) and subsequent expenses that come thereafter
-
-
-
Adds an FAQ page to the app along with a few miscellaneous fixes
Misc fixes include - A fix to the contact page related spec description - A name related fix in the footer wrt who has worked on the app
-
-
Redirects a successful user signup to app home page
Fixes failing specs with this change
-
-
Displays user name as part of the welcome message
This message is also displayed when a user has no expenses
-
Removes index display of user expenses
This change is added because user expenses are now displayed on app home page. The index display of expenses is thereby no longer used.
-
-
-
-
adds an extra line between private scope and method under it
This increases code readability
-
-
-
Sorts the correct datatable column
The datatable columns start with an index 0 and since we’re sorting the expenses based on the criteria that the most recently made expense(i.e., based on actual expense date) should show up first, hence this change is added to the appropriate column.
-
Disables datatables sorting for 'edit' and 'delete' columns
Datatables provides sorting on all columns by default. Sorting wrt the ‘edit’ and ‘delete’ columns is of no use when displaying expenses and they’re hence removed.
-
Ensures that redirection is done at URI level
This is basically because it’s an HTTP specification. One can read more on this on the link - https://viget.com/extend/rails-named-routes-path-vs-url
-
Commits on Oct 24, 2015
-
-
-
-
-
Adds a DB index to render the app homepage faster
User expenses are displayed on app homepage. As the number of expenses grow in number this multiple key index(based on the user_id and the created_at) would help fetch that data from the table faster. For more details, one could consider referring the link - http://stackoverflow.com/questions/4445507/rails-created-at-when-user-fo r-ordering-should-you-add-an-index-to-the-table
-
-
Tests user association of an expense
This test checks if the user association of an expense returns the correct user
-
-
-
Adds failing specs to check for an invalid expense name
An expense name can be invalid if it is ‘nil’ or if it is an empty string. Both these use cases are addressed in this commit.
-
Fixes failing spec wrt user sign in
Wrt an earlier commit, a user sign in redirects to the application home page in which user name is not a title. Hence appropriate changes are made here.
-
Uses scopes to retrieve most recent user expenses
The advantage with using scopes is that they’re chainable. Also for one liners we needn’t really have to go in for a class method. This commit also makes the below changes - - Changes the method name to make it more expressive - Appropriate changes are introduced in other places that used the original class method
-
Tests that expenses feed is displayed in a particular order
The user expenses feed is displayed on the home page in the order of the most recent first. This spec ensures that this order is maintained.
-
Uses "today's" date with time zone in mind
People across the globe are in different time zones, it’s a nice thing that hound pointed to refer to a date in the context of these time zones in order to avoid unexpected behavior in the future.
-
-
Adds missing spacing between curly braces
More spacing between the curly braces ensures better readability. Hence this is added.