Skip to content

Commit 5d074fb

Browse files
committed
Merge branch 'feature/new-fmu-certificate' into staging
2 parents 2265dca + 7ebcde9 commit 5d074fb

File tree

11 files changed

+23
-7
lines changed

11 files changed

+23
-7
lines changed

app/admin/fmu.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ def download_shapefiles(fmus)
4646
link_to I18n.t("active_admin.fmus_page.download_shapefile"), download_shapefile_admin_fmu_path(fmu), method: :get
4747
end
4848

49-
permit_params :id, :name, :certification_fsc, :certification_pefc,
49+
permit_params :id, :name,
50+
:certification_fsc, :certification_pefc, :certification_ls, :certification_pbn,
5051
:certification_olb, :certification_pafc, :certification_fsc_cw, :certification_tlv,
51-
:certification_ls, :esri_shapefiles_zip, :forest_type, :country_id,
52+
:esri_shapefiles_zip, :forest_type, :country_id,
5253
fmu_operator_attributes: [:id, :operator_id, :start_date, :end_date]
5354

5455
filter :id, as: :select
@@ -95,6 +96,7 @@ def download_shapefiles(fmus)
9596
column :certification_pefc
9697
column :certification_olb
9798
column :certification_pafc
99+
column :certification_pbn
98100
column :certification_fsc_cw
99101
column :certification_tlv
100102
column :certification_ls
@@ -142,6 +144,7 @@ def download_shapefiles(fmus)
142144
row :certification_olb
143145
row :certification_pafc
144146
row :certification_fsc_cw
147+
row :certification_pbn
145148
row :certification_tlv
146149
row :certification_ls
147150
end
@@ -159,6 +162,7 @@ def download_shapefiles(fmus)
159162
column "PEFC", :certification_pefc
160163
column "OLB", :certification_olb
161164
column "PAFC", :certification_pafc
165+
column "PbN", :certification_pbn
162166
column "FSC CW", :certification_fsc_cw
163167
column "TLV", :certification_tlv
164168
column "LS", :certification_ls
@@ -186,6 +190,7 @@ def download_shapefiles(fmus)
186190
f.input :certification_olb
187191
f.input :certification_pafc
188192
f.input :certification_fsc_cw
193+
f.input :certification_pbn
189194
f.input :certification_tlv
190195
f.input :certification_ls
191196
end

app/importers/observations_importer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ObservationsImporter < FileDataImport::BaseImporter
3030

3131
belongs_to Fmu,
3232
permitted_attributes: %i[
33-
geojson forest_type certification_fsc certification_pefc
33+
geojson forest_type certification_fsc certification_pefc certification_pbn
3434
certification_olb certification_vlc certification_vlo certification_tltv
3535
],
3636
permitted_translations: %i[name]

app/models/fmu.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def update_geojson_properties
9999
"certification_olb" => certification_olb,
100100
"certification_pafc" => certification_pafc,
101101
"certification_fsc_cw" => certification_fsc_cw,
102+
"certification_pbn" => certification_pbn,
102103
"certification_tlv" => certification_tlv,
103104
"certification_ls" => certification_ls,
104105
"observations" => active_observations.reload.uniq.count,

app/resources/v1/fmu_resource.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class FmuResource < BaseResource
99
attributes :name, :geojson, :forest_type,
1010
:certification_fsc, :certification_pefc, :certification_olb,
1111
:certification_pafc, :certification_fsc_cw, :certification_tlv,
12-
:certification_ls
12+
:certification_ls, :certification_pbn
1313

1414
has_one :country
1515
has_one :operator, foreign_key_on: :related
1616

1717
filters :country, :free, :certification, :operator
1818

1919
filter :certification, apply: ->(records, value, _options) {
20-
values = value.select { |c| %w[fsc pefc olb pafc fsc_cw tlv ls].include? c }
20+
values = value.select { |c| %w[fsc pefc olb pafc pbn fsc_cw tlv ls].include? c }
2121
return records unless values.any?
2222

2323
certifications = []

app/resources/v1/operator_resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def set_active
3636
end
3737

3838
filter :certification, apply: ->(records, value, _options) {
39-
values = value.select { |c| %w[fsc pefc olb pafc fsc_cw tlv ls].include? c }
39+
values = value.select { |c| %w[fsc pefc olb pafc pbn fsc_cw tlv ls].include? c }
4040
return records unless values.any?
4141

4242
certifications = []

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ en:
659659
certification_ls: Certification ls #g
660660
certification_olb: Certification olb #g
661661
certification_pafc: Certification pafc #g
662+
certification_pbn: Certification pbn #g
662663
certification_pefc: Certification pefc #g
663664
certification_tlv: Certification tlv #g
664665
country: :activerecord.models.country #g

config/locales/es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ es:
676676
certification_ls: Certificación LS
677677
certification_olb: Certificación OLB
678678
certification_pafc: Certificación PAFC
679+
certification_pbn: Certificación PbN
679680
certification_pefc: Certificación PEFC
680681
certification_tlv: Certificación TLV
681682
country: :activerecord.models.country
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddPbnCertificateToFmu < ActiveRecord::Migration[7.2]
2+
def change
3+
add_column :fmus, :certification_pbn, :boolean, default: false, null: false
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.2].define(version: 2025_07_16_100255) do
13+
ActiveRecord::Schema[7.2].define(version: 2025_07_17_073611) do
1414
create_schema "tiger"
1515
create_schema "tiger_data"
1616
create_schema "topology"
@@ -246,6 +246,7 @@
246246
t.datetime "deleted_at", precision: nil
247247
t.boolean "certification_ls", default: false, null: false
248248
t.string "name", null: false
249+
t.boolean "certification_pbn", default: false, null: false
249250
t.index ["country_id"], name: "index_fmus_on_country_id"
250251
t.index ["deleted_at"], name: "index_fmus_on_deleted_at"
251252
t.index ["forest_type"], name: "index_fmus_on_forest_type"

spec/fixtures/snapshots/importers/geojson_fmus_importer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"certification_tlv": false,
5151
"certification_pafc": false,
5252
"certification_pefc": false,
53+
"certification_pbn": false,
5354
"certification_fsc_cw": false
5455
},
5556
"geometry": {

0 commit comments

Comments
 (0)