Skip to content

Commit

Permalink
And renames agroforestry_present to agroforestry_practices
Browse files Browse the repository at this point in the history
  • Loading branch information
simaob committed Sep 28, 2016
1 parent 9db1384 commit b1dfa03
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/analyses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def set_analysis
# Never trust parameters from the scary internet, only allow the white list through.
def analysis_params
params.require(:analysis).permit(:geo_location_id, :area, :yield,
:yield_unit, :agroforestry_present, :crop, :tillage, :agrochemical_amount,
:yield_unit, :agroforestry_practices, :crop, :tillage, :agrochemical_amount,
:rice_type, :irrigation_regime, :flooding, :cultivation_time,
:lime_amount, :dolomite_amount, :annual_cultivation_cycles,
fertilizers_attributes: [ :id, :amount, :category, :addition_type, :area ],
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/analyses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def set_analysis

def analysis_params
params.require(:analysis).permit(:geo_location_id, :area, :yield,
:yield_unit, :agroforestry_present, :crop, :tillage, :agrochemical_amount,
:yield_unit, :agroforestry_practices, :crop, :tillage, :agrochemical_amount,
:rice_type, :irrigation_regime, :flooding, :cultivation_time,
:lime_amount, :dolomite_amount,
fertilizers_attributes: [ :id, :amount, :category, :addition_type, :area ],
Expand Down
2 changes: 1 addition & 1 deletion app/models/analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def emissions_from_fossil_fuel_use
end

def changes_in_carbon_content
return nil if rice? || !agroforestry_present?
return nil if rice? || !agroforestry_practices?
#(Area (ha) * Ccrop type Monoculture (t C ha-1)) + (Area (ha) *
# Ccrop type Agroforestry (t C ha-1 yr-1)) *44/12
r = CROPS.select{|t| t[:slug] == crop}.first
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/analysis_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def analysis
total += val

# shaded
if object.agroforestry_present?
if object.agroforestry_practices?
val = object.changes_in_carbon_content
emissions_by_source << {
slug: "agroforestry",
Expand Down
4 changes: 2 additions & 2 deletions app/views/analyses/_analysis_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<div class="input-group -third">
<div>
<div class="c-field -full -light">
<label class="text -label" for="">Agroforestry present?</label>
<%= f.select :agroforestry_present, options_for_select([["Yes", true], ["No", false]]) %>
<label class="text -label" for="">Agroforestry practices?</label>
<%= f.select :agroforestry_practices, options_for_select([["Yes", true], ["No", false]]) %>
</div>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/analyses/_crops.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
additional silviculture?
</div>
<span class="c-field">
<%= f.select :agroforestry_present, options_for_select([["Yes", true], ["No", false]]) %>
<%= f.select :agroforestry_practices, options_for_select([["Yes", true], ["No", false]]) %>
</span>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenameAgroforestryPresentToAgroforestryPracticesOnAnalyses < ActiveRecord::Migration[5.0]
def change
rename_column :analyses, :agroforestry_present, :agroforestry_practices
end
end

0 comments on commit b1dfa03

Please sign in to comment.