-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rails way #26
Merged
Merged
Rails way #26
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… tests results in faster runtime
…' & 'complete' template
…ge if viewer user has logged in
…ing in fewer SQL Queries
…se and fewer SQL queries
…tion Error in test suite
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings some big improvements focusing on backend system. I have highlighted some of it here.
Linting Errors
erblint
Currently
this PR
rubocop
(includes rspec, factory-bot, capybara & rails)
Currently
..
..
after scrolling for a few moments 🥱
..
..
this PR
(this will be auto-corrected later)
Test Suite
Currently (without headless)
this PR (with headless)
Requests
Some actions render both
HTML
&turbo_stream
actions likeThaalis#index
action,Transactions#all
action, etc. The logic defined in these actions runs twice, each for both actions,HTML
&turbo_stream
.Meaning if you have logic that triggers a SQL request, it would make that request twice, for each action.
So we need those resources to load only for turbo stream action but it is not explicitly defined in the controller. So currently it loads resources for
HTML
action too. For example:Thaali
index
(Homepage)Currently
this PR
By using the
respond_to
method, we avoid making unnecessary SQL calls hence making theHTML
template load faster:Gems added:
Here is the list of changes:
In schema
name
uniqueness constraint withits
.year
uniqueness constraint withnumber
.thaali_takhmeens
tothaalis
.address
,balance
,paid
,is_complete
, androle
attributes.In tests
robocop-rspec
, andrubocop-capybara
gems to address all linting errors in test suites.In controllers
turbo_stream
action and not in bothhtml
&turbo_stream
.preload
method to load associated resources resulting in faster response time.length
instead of thecount
method which avoids making separate SQL queries.application_controller
In views
number_with_delimeter
method.no_results
partial if resources don't exist.balance
amount instead of font awesome icons:check
&x-mark
in turbo_stream pages.Sabeel#active
&Sabeel#inactive
views.edit
,delete
,new thaali
&new transaction
buttons if the user type is aviewer
.html-safe
method.In seeds
viewer
type.Constants
APARTMENT
with 5 apartment names.MODES
with 3 modes.ROLES
with 3 roles.Misc:
frozen_string_literal
comments.rubocop-rails
to address all linting errors for rails.