-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create filing status federal tax table types.
- Loading branch information
Showing
11 changed files
with
184 additions
and
42 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# == Schema Information | ||
# | ||
# Table name: federal_tax_table_types | ||
# | ||
# id :bigint not null, primary key | ||
# filing_status :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
class FederalTaxTableType < ApplicationRecord | ||
has_many :federal_tax_brackets | ||
|
||
FILING_TYPES = %w(single married_filing_jointly married_filing_separately head_of_household) | ||
validates :filing_status, presence: true, inclusion: FILING_TYPES | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateTaxTableTypes < ActiveRecord::Migration[7.0] | ||
def up | ||
FederalTaxTableType.create(filing_status: "single") | ||
FederalTaxTableType.create(filing_status: "married_filing_jointly") | ||
FederalTaxTableType.create(filing_status: "married_filing_separately") | ||
FederalTaxTableType.create(filing_status: "head_of_household") | ||
|
||
# Federal tax brackets for single filers in 2024 | ||
FederalTaxBracket.create!(tier: "Tier 1", bottom_range: 0, top_range: 11_600, rate: 0.1, cumulative: 0, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 2", bottom_range: 11_601, top_range: 47_150, rate: 0.12, cumulative: 1_160, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 3", bottom_range: 47_151, top_range: 100_525, rate: 0.22, cumulative: 5_426, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 4", bottom_range: 100_526, top_range: 191_950, rate: 0.24, cumulative: 17_168.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 5", bottom_range: 191_951, top_range: 243_725, rate: 0.32, cumulative: 39_110.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 6", bottom_range: 243_726, top_range: 609_350, rate: 0.35, cumulative: 55_678.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
FederalTaxBracket.create(tier: "Tier 7", bottom_range: 609_351, top_range: 10_000_000, rate: 0.35, cumulative: 183_647.25, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "single").id) | ||
|
||
# Federal tax brackets for married joint filers in 2024 | ||
FederalTaxBracket.create(tier: "Tier 1", bottom_range: 0, top_range: 23_200, rate: 0.1, cumulative: 0, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 2", bottom_range: 23_201, top_range: 94_300, rate: 0.12, cumulative: 2_320, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 3", bottom_range: 94_301, top_range: 201_050, rate: 0.22, cumulative: 10_852, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 4", bottom_range: 201_051, top_range: 383_900, rate: 0.24, cumulative: 34_337, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 5", bottom_range: 383_901, top_range: 487_450, rate: 0.32, cumulative: 78_221, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 6", bottom_range: 487_451, top_range: 731_200, rate: 0.35, cumulative: 111_357, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
FederalTaxBracket.create(tier: "Tier 7", bottom_range: 731_201, top_range: 10_000_000, rate: 0.35, cumulative: 196_669.50, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_jointly").id) | ||
|
||
# Federal tax brackets for married separate filers in 2024 | ||
FederalTaxBracket.create(tier: "Tier 1", bottom_range: 0, top_range: 11_600, rate: 0.1, cumulative: 0, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 2", bottom_range: 11_601, top_range: 47_150, rate: 0.12, cumulative: 1_160, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 3", bottom_range: 47_151, top_range: 100_525, rate: 0.22, cumulative: 5_426, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 4", bottom_range: 100_526, top_range: 191_950, rate: 0.24, cumulative: 17_168.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 5", bottom_range: 191_951, top_range: 243_725, rate: 0.32, cumulative: 39_110.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 6", bottom_range: 243_726, top_range: 365_600, rate: 0.35, cumulative: 55_678.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
FederalTaxBracket.create(tier: "Tier 7", bottom_range: 365_601, top_range: 10_000_000, rate: 0.35, cumulative: 98_334.75, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "married_filing_separately").id) | ||
|
||
# Federal tax brackets for head of household filers in 2024 | ||
FederalTaxBracket.create(tier: "Tier 1", bottom_range: 0, top_range: 16_550, rate: 0.1, cumulative: 0, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 2", bottom_range: 16_551, top_range: 63_100, rate: 0.12, cumulative: 1_655, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 3", bottom_range: 63_101, top_range: 100_500, rate: 0.22, cumulative: 7_241, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 4", bottom_range: 100_501, top_range: 191_950, rate: 0.24, cumulative: 15_469, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 5", bottom_range: 191_951, top_range: 243_700, rate: 0.32, cumulative: 37_417, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 6", bottom_range: 243_701, top_range: 609_350, rate: 0.35, cumulative: 53_977, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
FederalTaxBracket.create(tier: "Tier 7", bottom_range: 609_351, top_range: 10_000_000, rate: 0.35, cumulative: 181_954.5, federal_tax_table_type_id: FederalTaxTableType.find_by(filing_status: "head_of_household").id) | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DataMigrate::Data.define(version: 20240715131425) | ||
DataMigrate::Data.define(version: 20240910125100) |
11 changes: 11 additions & 0 deletions
11
db/migrate/20240911123818_create_federal_tax_table_types.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateFederalTaxTableTypes < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :federal_tax_table_types do |t| | ||
t.string :filing_status | ||
|
||
t.timestamps | ||
end | ||
|
||
add_reference :federal_tax_brackets, :federal_tax_table_type, foreign_key: true | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# == Schema Information | ||
# | ||
# Table name: federal_tax_table_types | ||
# | ||
# id :bigint not null, primary key | ||
# filing_status :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
FactoryBot.define do | ||
factory :federal_tax_table_type do | ||
|
||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# == Schema Information | ||
# | ||
# Table name: federal_tax_table_types | ||
# | ||
# id :bigint not null, primary key | ||
# filing_status :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
require 'rails_helper' | ||
|
||
RSpec.describe FederalTaxTableType, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |