Skip to content

Commit

Permalink
Merge pull request #67 from camsys/quarter3
Browse files Browse the repository at this point in the history
2.7.0
  • Loading branch information
AlexAndradeCS authored Sep 18, 2019
2 parents 47cde52 + d441468 commit 8100385
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 26 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/jobs/asset_depreciation_expense_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(current_depreciation_date: nil)).each do |a|
asset = asset_klass.get_typed_asset(a)
asset.update_asset_book_value
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/book_value_update_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
1 change: 1 addition & 0 deletions app/models/depreciation_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion app/views/grants/_index_actions.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
%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'
14 changes: 0 additions & 14 deletions app/views/grants/_index_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions app/views/transit_assets/_accounting_funding_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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}) + " %");
Expand All @@ -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){
Expand Down
6 changes: 4 additions & 2 deletions app/views/transit_assets/_accounting_purchase_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,7 +60,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($('#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}) + " %");
Expand All @@ -69,7 +71,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());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeTimeDeprecationActivity < ActiveRecord::DataMigration
def up
Activity.find_by(job_name: 'AssetDepreciationExpenseUpdateJob').update!(execution_time: '22:01')
end
end
5 changes: 5 additions & 0 deletions db/migrate/20190708132532_add_indices_depreciation_entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddIndicesDepreciationEntries < ActiveRecord::Migration[5.2]
def change
add_index(:depreciation_entries, [:transam_asset_id, :event_date, :description], unique: true, name: 'transam_asset_event_date_description_uniq_idx')
end
end
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
Expand Down
2 changes: 1 addition & 1 deletion lib/transam_accounting/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TransamAccounting
VERSION = "2.6.1"
VERSION = "2.7.0"
end
1 change: 1 addition & 0 deletions spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
organization_type_id { 1 }
sequence(:name) { |n| "Org #{n}" }
short_name { name }
legal_name { name }
license_holder { true }
end

Expand Down

0 comments on commit 8100385

Please sign in to comment.