Skip to content

Commit

Permalink
Fixed bug in asset.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-TAK committed May 22, 2020
1 parent 34181a8 commit 9574b90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/wkdashboard/005_graph_assets_per_month.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Assets:
chart_type: line
code_str: "asset_value_by_month = WkAssetDepreciation.where('depreciation_date BETWEEN ? AND ?', (@to - 12.months + 1.days), @to).select('extract(year from wk_asset_depreciations.depreciation_date) as year_val, extract(month from wk_asset_depreciations.depreciation_date) as month_val, sum(actual_amount - depreciation_amount) as total_amount').group('extract(year from wk_asset_depreciations.depreciation_date), extract(month from wk_asset_depreciations.depreciation_date)') ;assest_value_hash = Hash.new ;asset_value_by_month.each {|c| assest_value_hash[(c.year_val.to_s + (c.month_val.to_s.length == 1 ? '0' : '') + c.month_val.to_s).to_i] = c.total_amount } ;yearMonthArr = assest_value_hash.keys.sort ;fields = [] ;12.times {|m| fields << month_name(((@to.month - 1 - m) % 12) + 1).first(3)}; @assest_value_arr = [0]*12 ;last_month = (@to - 12.months + 1.days).month ;last_total = 0 ;yearMonthArr.each do |yearMon| ;month = yearMon.to_s.last(2).to_i ;while last_month != month && ((last_month + 1) % 12 != month); @assest_value_arr[@to.month - ((last_month + 1) % 12)] = last_total; last_month += 1; end; @assest_value_arr[@to.month - yearMon.to_s.last(2).to_i] = assest_value_hash[yearMon]; last_month = month; last_total = assest_value_hash[yearMon]; end;{ 'fields' => fields.reverse };"
code_str: "asset_value_by_month = WkAssetDepreciation.where('depreciation_date BETWEEN ? AND ?', (@to - 12.months + 1.days), @to).select('extract(year from wk_asset_depreciations.depreciation_date) as year_val, extract(month from wk_asset_depreciations.depreciation_date) as month_val, sum(actual_amount - depreciation_amount) as total_amount').group('extract(year from wk_asset_depreciations.depreciation_date), extract(month from wk_asset_depreciations.depreciation_date)') ;assest_value_hash = Hash.new ;asset_value_by_month.each {|c| assest_value_hash[(c.year_val.to_i.to_s + (c.month_val.to_i.to_s.length == 1 ? '0' : '') + c.month_val.to_i.to_s).to_i] = c.total_amount } ;yearMonthArr = assest_value_hash.keys.sort ;fields = [] ;12.times {|m| fields << month_name(((@to.month - 1 - m) % 12) + 1).first(3)}; @assest_value_arr = [0]*12 ;last_month = (@to - 12.months + 1.days).month ;last_total = 0 ;yearMonthArr.each do |yearMon| ;month = yearMon.to_s.last(2).to_i ;while last_month != month && ((last_month + 1) % 12 != month); @assest_value_arr[@to.month - ((last_month + 1) % 12)] = last_total; last_month += 1; end; @assest_value_arr[@to.month - yearMon.to_s.last(2).to_i] = assest_value_hash[yearMon]; last_month = month; last_total = assest_value_hash[yearMon]; end;{ 'fields' => fields.reverse };"
x_title: "label_months"
y_title: "label_amount"
names_of_data:
Expand Down

0 comments on commit 9574b90

Please sign in to comment.