-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
✨ Marketplace
: Create and Update TaxRate
#1186
Conversation
da2d35d
to
71b7a3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚕
Looks good, but see below for my question re: taxes on products.
<h3>Tax Rates</h3> | ||
<%= render policy_scope(marketplace.tax_rates) %> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line. </high value comment>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allegedly, prettier
has an erb
linter... allegedly
class Marketplace | ||
class TaxRate < Record | ||
self.table_name = "marketplace_tax_rates" | ||
belongs_to :marketplace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it might be a bit more scannable to have the self....
lines grouped, and the belongs_to
in a separate "block" (i.e. separated by a blank line). (Unless they have to be declared in this order?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
app/furniture/marketplace/routes.rb
Outdated
router.resources :orders, only: [:show] | ||
router.resources :products | ||
router.resources :products do | ||
router.resources :tax_rates, only: [:create, :destroy, :index, :show] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see code to edit and display the Marketplace Tax Rates, but there is this products/tax_rates
set of routes, and also a reference from the marketplace products table to tax rates, although the TaxRate
model merely belongs_to :marketplace
-- maybe you are missing the has_many :marketplace_products
on TaxRate
and the belongs_to :tax_rate, optional: true
on MarketplaceProduct
?
I'm not sure if the Tax Rates on Products are left over from a previous version, or if you intend to use those somehow differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should get rid of this since I haven't started the associating TaxRate
s to Product
s yet.
class CreateMarketplaceTaxRates < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :marketplace_tax_rates, id: :uuid do |t| | ||
t.float :tax_rate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Float feels correct to me, since I agree that it could be a percent, or a fractional amount, or an integer fixed amount. (Maybe eventually we'll end up with an enum here to say if it is %age or "fixed".)
- #1137 This throws together the basic `CRUD` operations for `TaxRate`. Going to do a bit of tidying and add some tests, then record a video of the use case. I may decide I want to add in the setting of the `TaxRate` on the `Product`, but maybe I'll wait and add that independently...
I think mayyybeeeeeeee it's better to support decimals.
2e96cb9
to
da72da4
Compare
This also addresses Ana's comments re: Tidying
Marketplace
:Tax
Collection and Compliance #1137Slaps some
update
andcreate
actions together for settingTaxRate
s.That said, I don't know that an integer or a float is better, since I suppose there could be a partial tax?
Also, I tried to set it up so tax rates applied across all spaces; but then I ran into some weirdness... if y'all have ideas happy to hear.