From fe06d119b6674cd49b2ad8bcc3914c01cea6ce8d Mon Sep 17 00:00:00 2001 From: "Benjamin Randolphgit config --global user.email neb417@gmail.comgit config --global init.defaultBranch maingit config --global core.editor atom" Date: Mon, 9 Oct 2023 09:13:40 -0600 Subject: [PATCH 1/3] Remove unused concern --- app/controllers/application_controller.rb | 1 - .../concerns/set_dashboard_instance_variables.rb | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 app/controllers/concerns/set_dashboard_instance_variables.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 102a448..09705d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,2 @@ class ApplicationController < ActionController::Base - include SetDashboardInstanceVariables end diff --git a/app/controllers/concerns/set_dashboard_instance_variables.rb b/app/controllers/concerns/set_dashboard_instance_variables.rb deleted file mode 100644 index 855860d..0000000 --- a/app/controllers/concerns/set_dashboard_instance_variables.rb +++ /dev/null @@ -1,12 +0,0 @@ -module SetDashboardInstanceVariables - extend ActiveSupport::Concern - - included do - # before_action :set_variables - end - - def set_variables - Rails.logger.debug "**** Dashboard Vars Being Set ****" - @totals = FixedExpense.total_costs - end -end From d5840ddb0ce3fa861d10e2e4f7be6ab42cb3763d Mon Sep 17 00:00:00 2001 From: "Benjamin Randolphgit config --global user.email neb417@gmail.comgit config --global init.defaultBranch maingit config --global core.editor atom" Date: Mon, 9 Oct 2023 09:18:26 -0600 Subject: [PATCH 2/3] Remove unused code and return index to update for tests that put/patch --- app/controllers/fixed_expenses_controller.rb | 1 - .../controllers/fixed_expense_controller.js | 26 +------------------ spec/requests/fixed_expenses_spec.rb | 2 +- spec/routing/fixed_expenses_routing_spec.rb | 4 +-- spec/routing/incomes_routing_spec.rb | 4 +-- 5 files changed, 6 insertions(+), 31 deletions(-) diff --git a/app/controllers/fixed_expenses_controller.rb b/app/controllers/fixed_expenses_controller.rb index 36d22df..df5ab48 100644 --- a/app/controllers/fixed_expenses_controller.rb +++ b/app/controllers/fixed_expenses_controller.rb @@ -57,7 +57,6 @@ def destroy @fixed_expenses = FixedExpense.get_ordered respond_to do |format| format.html { redirect_to fixed_expenses_path, notice: "Fixed expense was successfully destroyed." } - # format.turbo_stream { render turbo_stream: turbo_stream.remove(@fixed_expense) } format.turbo_stream end end diff --git a/app/javascript/controllers/fixed_expense_controller.js b/app/javascript/controllers/fixed_expense_controller.js index e35e972..a18a9f0 100644 --- a/app/javascript/controllers/fixed_expense_controller.js +++ b/app/javascript/controllers/fixed_expense_controller.js @@ -2,29 +2,5 @@ import { Controller } from "@hotwired/stimulus" // import { get } from "@rails/request.js" export default class extends Controller { - static targets = [ "fixedTotals" ] - updateTotals(event) { - const data = Object.fromEntries(new FormData(event.target).entries()) - console.log(data) - console.log(data["fixed_expense[amount]"]) - console.log(data["fixed_expense[frequency]"]) - console.log(this.fixedTotalsTarget) - let amount = data["fixed_expense[amount]"] - let frequency = data["fixed_expense[frequency]"] - // get(`/fixed_expenses/total_expenses?`) - } -} - - -// export default class extends Controller { -// static targets = ["monthlyPaymentDisplay"] -// -// homeDataUpdate(event){ -// let homeId = event.target.selectedOptions[0].value -// let target = this.monthlyPaymentDisplayTarget.id -// get(`/recurring_payments/monthly_payment?home=${homeId}&target=${target}`,{ -// responseKind: "turbo-stream" -// }) -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/spec/requests/fixed_expenses_spec.rb b/spec/requests/fixed_expenses_spec.rb index 4bf6298..60e1224 100644 --- a/spec/requests/fixed_expenses_spec.rb +++ b/spec/requests/fixed_expenses_spec.rb @@ -83,7 +83,7 @@ end end - describe "PATCH /index" do + describe "PATCH /update" do context "with valid parameters" do let(:new_attributes) { skip("Add a hash of attributes valid for your model") diff --git a/spec/routing/fixed_expenses_routing_spec.rb b/spec/routing/fixed_expenses_routing_spec.rb index 991d33a..83c5a26 100644 --- a/spec/routing/fixed_expenses_routing_spec.rb +++ b/spec/routing/fixed_expenses_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/fixed_expenses").to route_to("fixed_expenses#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end diff --git a/spec/routing/incomes_routing_spec.rb b/spec/routing/incomes_routing_spec.rb index 870f01b..d03193f 100644 --- a/spec/routing/incomes_routing_spec.rb +++ b/spec/routing/incomes_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/incomes").to route_to("incomes#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/incomes/1").to route_to("incomes#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/incomes/1").to route_to("incomes#update", id: "1") end From 31ee22e10b8ba62245e1d9eaa78a3fa5b28c908b Mon Sep 17 00:00:00 2001 From: "Benjamin Randolphgit config --global user.email neb417@gmail.comgit config --global init.defaultBranch maingit config --global core.editor atom" Date: Mon, 9 Oct 2023 09:20:30 -0600 Subject: [PATCH 3/3] Remove unused code --- app/controllers/dashboard_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index dff97de..e4797b4 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,5 +1,4 @@ class DashboardController < ApplicationController - include SetDashboardInstanceVariables def index @incomes = Income.all @fixed_expenses = FixedExpense.get_ordered