From eca64e0901cb0f7c14dd3d57b7ea890646be0501 Mon Sep 17 00:00:00 2001 From: mathmerized Date: Wed, 12 Jun 2019 10:42:07 -0400 Subject: [PATCH 01/12] point to quarter3 --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b9670892..b201a762 100644 --- a/Gemfile +++ b/Gemfile @@ -7,9 +7,9 @@ source "https://rubygems.org" # To use debugger # gem 'debugger' -gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter2 -gem 'transam_reporting', git: 'https://github.com/camsys/transam_reporting', branch: :quarter2 -gem 'transam_transit', git: 'https://github.com/camsys/transam_transit', branch: :quarter2 +gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter3 +gem 'transam_reporting', git: 'https://github.com/camsys/transam_reporting', branch: :quarter3 +gem 'transam_transit', git: 'https://github.com/camsys/transam_transit', branch: :quarter3 gem 'mysql2', '~> 0.5.1' # lock gem for dummy app gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath From f9b113d84b8630fc1495b204908f0d76b9094d74 Mon Sep 17 00:00:00 2001 From: Alex Andrade Date: Mon, 1 Jul 2019 17:29:45 -0400 Subject: [PATCH 02/12] [TTPLAT-989] Add event dates to history log for assets; update labels in asset history. --- app/models/book_value_update_event.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/book_value_update_event.rb b/app/models/book_value_update_event.rb index 04ef3341..398107f8 100644 --- a/app/models/book_value_update_event.rb +++ b/app/models/book_value_update_event.rb @@ -44,7 +44,7 @@ def self.asset_event_type # This must be overriden otherwise a stack error will occur def get_update - "Book value: #{self.book_value}." + "Book value: #{self.book_value}" end def can_update? From 85447d72b5864c852e2532d41a5660187ec9f23d Mon Sep 17 00:00:00 2001 From: mathmerized Date: Mon, 8 Jul 2019 09:27:54 -0400 Subject: [PATCH 03/12] TTPLAT-1055 defensive checkes to prevent duplicate depreciation entries --- .../20190708132343_change_time_deprecation_activity.rb | 5 +++++ .../20190708132532_add_indices_depreciation_entries.rb | 5 +++++ db/seeds.rb | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/data_migrations/20190708132343_change_time_deprecation_activity.rb create mode 100644 db/migrate/20190708132532_add_indices_depreciation_entries.rb diff --git a/db/data_migrations/20190708132343_change_time_deprecation_activity.rb b/db/data_migrations/20190708132343_change_time_deprecation_activity.rb new file mode 100644 index 00000000..bc8dc902 --- /dev/null +++ b/db/data_migrations/20190708132343_change_time_deprecation_activity.rb @@ -0,0 +1,5 @@ +class ChangeTimeDeprecationActivity < ActiveRecord::DataMigration + def up + Activity.find_by(job_name: 'AssetDepreciationExpenseUpdateJob').update!(execution_time: '22:01') + end +end \ No newline at end of file diff --git a/db/migrate/20190708132532_add_indices_depreciation_entries.rb b/db/migrate/20190708132532_add_indices_depreciation_entries.rb new file mode 100644 index 00000000..85a4bc17 --- /dev/null +++ b/db/migrate/20190708132532_add_indices_depreciation_entries.rb @@ -0,0 +1,5 @@ +class AddIndicesDepreciationEntries < ActiveRecord::Migration[5.2] + def change + add_index(:depreciation_entries, [:transam_asset_id, :event_date, :description], unique: true) + end +end diff --git a/db/seeds.rb b/db/seeds.rb index 71135c64..e2b3e79b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -26,7 +26,7 @@ system_activity: true, frequency_quantity: 1, frequency_type_id: 3, - execution_time: '00:01', + execution_time: '22:01', job_name: 'AssetDepreciationExpenseUpdateJob', active: true } ] From 4673728ca311d0020f11f9591359e2259a5dd8b8 Mon Sep 17 00:00:00 2001 From: mathmerized Date: Mon, 8 Jul 2019 09:42:48 -0400 Subject: [PATCH 04/12] fix index name TTPLAT-1055 --- db/migrate/20190708132532_add_indices_depreciation_entries.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190708132532_add_indices_depreciation_entries.rb b/db/migrate/20190708132532_add_indices_depreciation_entries.rb index 85a4bc17..971123f7 100644 --- a/db/migrate/20190708132532_add_indices_depreciation_entries.rb +++ b/db/migrate/20190708132532_add_indices_depreciation_entries.rb @@ -1,5 +1,5 @@ class AddIndicesDepreciationEntries < ActiveRecord::Migration[5.2] def change - add_index(:depreciation_entries, [:transam_asset_id, :event_date, :description], unique: true) + add_index(:depreciation_entries, [:transam_asset_id, :event_date, :description], unique: true, name: 'transam_asset_event_date_description_uniq_idx') end end From d47c5db2265914194c4542ef12e5667814204682 Mon Sep 17 00:00:00 2001 From: mathmerized Date: Mon, 8 Jul 2019 10:51:12 -0400 Subject: [PATCH 05/12] TTPLAT-1055 add rails uniqueness validation --- app/models/depreciation_entry.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/depreciation_entry.rb b/app/models/depreciation_entry.rb index 565b8894..7fcf3e0a 100644 --- a/app/models/depreciation_entry.rb +++ b/app/models/depreciation_entry.rb @@ -26,6 +26,7 @@ class DepreciationEntry < ActiveRecord::Base #validates :asset, :presence => true validates :description, :presence => true validates :book_value, :presence => true + validates :description, :uniqueness => { :scope => [:transam_asset_id, :event_date]} # List of allowable form param hash keys From 219d1f8fa1164ec13889d665b57f66e561f4d38a Mon Sep 17 00:00:00 2001 From: mathmerized Date: Wed, 24 Jul 2019 09:51:27 -0400 Subject: [PATCH 06/12] TTPLAT-1055 fix annual depreciation entry to pick up assets with no depreciation expense entries yet --- app/jobs/asset_depreciation_expense_update_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/asset_depreciation_expense_update_job.rb b/app/jobs/asset_depreciation_expense_update_job.rb index 20a11d7a..71243d34 100644 --- a/app/jobs/asset_depreciation_expense_update_job.rb +++ b/app/jobs/asset_depreciation_expense_update_job.rb @@ -10,7 +10,7 @@ class AssetDepreciationExpenseUpdateJob < ActivityJob def run asset_klass = Rails.application.config.asset_base_class_name.constantize - asset_klass.not_in_transfer.where.not(current_depreciation_date: Policy.first.current_depreciation_date).each do |a| + asset_klass.not_in_transfer.where.not(current_depreciation_date: Policy.first.current_depreciation_date).or(asset_klass.not_in_transfer.where.not(current_depreciation_date: nil)).each do |a| asset = asset_klass.get_typed_asset(a) asset.update_asset_book_value end From 3c5350c9c8f42eb0c62a1e343d885492d20e7dfa Mon Sep 17 00:00:00 2001 From: mathmerized Date: Thu, 25 Jul 2019 16:13:04 -0400 Subject: [PATCH 07/12] all grant index actions should be together TTPLAT-1099 --- app/views/grants/_index_actions.html.haml | 16 +++++++++++++++- app/views/grants/_index_table.html.haml | 14 -------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/views/grants/_index_actions.html.haml b/app/views/grants/_index_actions.html.haml index 319ab90d..66c62a14 100644 --- a/app/views/grants/_index_actions.html.haml +++ b/app/views/grants/_index_actions.html.haml @@ -5,4 +5,18 @@ = select_tag(:state, options_for_select([["In Development / Open", "default"], ["All", "all"]].concat(Grant.state_names.collect{|a| [a.titleize, a]}), :selected => @state), :class => "form-control") = button_tag :class => 'btn btn-default', :type => 'submit' do - %i.fa.fa-filter \ No newline at end of file + %i.fa.fa-filter + +- if can? :create, Grant + .navbar-form.pull-right + = link_to new_grant_path, :class => 'btn btn-primary' do + %i.fa.fa-plus.fa-fw + = "Add Grant"; + .navbar-form.pull-right + %button.btn.btn-primary.btn-md.dropdown-toggle{:data => {:toggle => 'dropdown'}} + %i.fa.fa-file + = " Export" + %span.caret + %ul.dropdown-menu{:role => 'menu'} + %li + = link_to "XLSX", current_url(format: :xlsx), target: '_blank', title: 'Export all rows and columns to XLSX' \ No newline at end of file diff --git a/app/views/grants/_index_table.html.haml b/app/views/grants/_index_table.html.haml index 9085f7f5..bd7bd77a 100644 --- a/app/views/grants/_index_table.html.haml +++ b/app/views/grants/_index_table.html.haml @@ -24,20 +24,6 @@ - if show_actions == 1 = render :partial => "grants/index_actions" - - if can? :create, Grant - .navbar-form.pull-right - = link_to new_grant_path, :class => 'btn btn-primary' do - %i.fa.fa-plus.fa-fw - = "Add Grant"; - .navbar-form.pull-right - %button.btn.btn-primary.btn-md.dropdown-toggle{:data => {:toggle => 'dropdown'}} - %i.fa.fa-file - = " Export" - %span.caret - %ul.dropdown-menu{:role => 'menu'} - %li - = link_to "XLSX", current_url(format: :xlsx), target: '_blank', title: 'Export all rows and columns to XLSX' - .table-responsive %table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table', :pagination => 'true', From 87644de857108ff982da01168e27a1ef5759cc9f Mon Sep 17 00:00:00 2001 From: Alex Andrade Date: Wed, 31 Jul 2019 14:35:20 -0400 Subject: [PATCH 08/12] [TTPLAT-1117] Add legal name to organization factories. --- spec/factories/organizations.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb index 4d78846f..53b3b5c1 100644 --- a/spec/factories/organizations.rb +++ b/spec/factories/organizations.rb @@ -12,6 +12,7 @@ organization_type_id { 1 } sequence(:name) { |n| "Org #{n}" } short_name { name } + legal_name { name } license_holder { true } end From a44414fa6ae9d613cabb21660304cded6a4a1984 Mon Sep 17 00:00:00 2001 From: mathmerized Date: Mon, 5 Aug 2019 11:06:28 -0400 Subject: [PATCH 09/12] TTPLAT-1055 fix bad negative --- app/jobs/asset_depreciation_expense_update_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/asset_depreciation_expense_update_job.rb b/app/jobs/asset_depreciation_expense_update_job.rb index 71243d34..3d7fad35 100644 --- a/app/jobs/asset_depreciation_expense_update_job.rb +++ b/app/jobs/asset_depreciation_expense_update_job.rb @@ -10,7 +10,7 @@ class AssetDepreciationExpenseUpdateJob < ActivityJob def run asset_klass = Rails.application.config.asset_base_class_name.constantize - asset_klass.not_in_transfer.where.not(current_depreciation_date: Policy.first.current_depreciation_date).or(asset_klass.not_in_transfer.where.not(current_depreciation_date: nil)).each do |a| + asset_klass.not_in_transfer.where.not(current_depreciation_date: Policy.first.current_depreciation_date).or(asset_klass.not_in_transfer.where(current_depreciation_date: nil)).each do |a| asset = asset_klass.get_typed_asset(a) asset.update_asset_book_value end From 25d4e5f3d477ef25e67b3923af070077fdec011e Mon Sep 17 00:00:00 2001 From: mathmerized Date: Sun, 15 Sep 2019 09:34:58 -0400 Subject: [PATCH 10/12] use only current tab when calculating pcnts for grant purchases --- app/views/transit_assets/_accounting_funding_form.html.haml | 4 ++-- app/views/transit_assets/_accounting_purchase_form.html.haml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/transit_assets/_accounting_funding_form.html.haml b/app/views/transit_assets/_accounting_funding_form.html.haml index a54f2963..dfe9094e 100644 --- a/app/views/transit_assets/_accounting_funding_form.html.haml +++ b/app/views/transit_assets/_accounting_funding_form.html.haml @@ -45,7 +45,7 @@ }); $('.funding_sources_grant_purchases_form .funding-pcnt').valid(); - var pcnt = $(this).val() * 100 / parseInt($('#purchase_cost').editable('getValue')['asset[purchase_cost]']); + var pcnt = $(this).val() * 100 / parseInt($(this).closest('.tab-content').find('#purchase_cost').editable('getValue')['asset[purchase_cost]']); $(this).parents('.funding-source-fields').find('.funding-pcnt').val(pcnt); $(this).parents('.funding-source-fields').find('.grant-purchase-pcnt.display-value').html(pcnt.toFixed(#{funding_pcnt_precision}) + " %"); @@ -56,7 +56,7 @@ var sum = 0; var tdc_sum = 0; var tdc_funding_programs = JSON.parse('#{FundingSource.where(funding_source_type: FundingSourceType.find_by(name: 'TDC')).map{|f| f.to_global_id.to_s}.to_json.html_safe}') - $('.funding_sources_grant_purchases_form .funding-pcnt').each(function() { + $(element).closest('.tab-content').find('.funding_sources_grant_purchases_form .funding-pcnt').each(function() { var program = $(this).parents('.funding-source-fields').find('.funding-source-global-sourceable').val(); if ($.inArray(program, tdc_funding_programs) >= 0){ diff --git a/app/views/transit_assets/_accounting_purchase_form.html.haml b/app/views/transit_assets/_accounting_purchase_form.html.haml index 3b772abe..79c7572f 100644 --- a/app/views/transit_assets/_accounting_purchase_form.html.haml +++ b/app/views/transit_assets/_accounting_purchase_form.html.haml @@ -58,7 +58,7 @@ }); $('.grants_grant_purchases_form .funding-pcnt').valid(); - var pcnt = $(this).val() * 100 / parseInt($('#purchase_cost').editable('getValue')['asset[purchase_cost]']); + var pcnt = $(this).val() * 100 / parseInt($(this).closest('.tab-content').find('#purchase_cost').editable('getValue')['asset[purchase_cost]']); $(this).parents('.grant-fields').find('.funding-pcnt').val(pcnt); $(this).parents('.grant-fields').find('.grant-purchase-pcnt.display-value').html(pcnt.toFixed(#{funding_pcnt_precision}) + " %"); @@ -69,7 +69,7 @@ var sum = 0; var tdc_sum = 0; var tdc_grants = JSON.parse('#{Grant.where(sourceable: FundingSource.where(funding_source_type: FundingSourceType.find_by(name: 'TDC'))).map{|f| f.to_global_id.to_s}.to_json.html_safe}') - $('.grants_grant_purchases_form .funding-pcnt').each(function() { + $(element).closest('.tab-content').find('.grants_grant_purchases_form .funding-pcnt').each(function() { var program = $(this).parents('.grant-fields').find('.global-sourceable').val(); if ($.inArray(program, tdc_grants) >= 0){ tdc_sum += Number($(this).val()); From a33e09b35eb41d8f765c1c303cc8f6695a0920f5 Mon Sep 17 00:00:00 2001 From: mathmerized Date: Mon, 16 Sep 2019 10:24:57 -0400 Subject: [PATCH 11/12] TTPLAT-1165 fix how we get puchase cost in grant component form --- app/views/transit_assets/_accounting_purchase_form.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/transit_assets/_accounting_purchase_form.html.haml b/app/views/transit_assets/_accounting_purchase_form.html.haml index 79c7572f..827eb091 100644 --- a/app/views/transit_assets/_accounting_purchase_form.html.haml +++ b/app/views/transit_assets/_accounting_purchase_form.html.haml @@ -14,6 +14,8 @@ :file => :vertical_file_input, :boolean => :vertical_boolean}) do |f| + #grant_purchase_cost{style: 'display:none;'}= asset.purchase_cost + %fieldset %legend{style: 'font-size: medium;'} Grants %label#grants-error.error @@ -58,7 +60,7 @@ }); $('.grants_grant_purchases_form .funding-pcnt').valid(); - var pcnt = $(this).val() * 100 / parseInt($(this).closest('.tab-content').find('#purchase_cost').editable('getValue')['asset[purchase_cost]']); + var pcnt = $(this).val() * 100 / parseInt($('#grant_purchase_cost').text()); $(this).parents('.grant-fields').find('.funding-pcnt').val(pcnt); $(this).parents('.grant-fields').find('.grant-purchase-pcnt.display-value').html(pcnt.toFixed(#{funding_pcnt_precision}) + " %"); From d441468f01ba9bafa49f08f991379cec45157d6c Mon Sep 17 00:00:00 2001 From: Alex Andrade Date: Wed, 18 Sep 2019 10:46:23 -0400 Subject: [PATCH 12/12] [TTPLAT-1141] Bump engine versions. --- lib/transam_accounting/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transam_accounting/version.rb b/lib/transam_accounting/version.rb index 340fec79..6102620a 100644 --- a/lib/transam_accounting/version.rb +++ b/lib/transam_accounting/version.rb @@ -1,3 +1,3 @@ module TransamAccounting - VERSION = "2.6.1" + VERSION = "2.7.0" end