demarches-normaliennes/app/models/champs/yes_no_champ.rb

55 lines
1.2 KiB
Ruby
Raw Normal View History

2020-08-06 16:35:45 +02:00
# == Schema Information
#
# Table name: champs
#
# id :integer not null, primary key
# data :jsonb
# fetch_external_data_exceptions :string is an Array
# private :boolean default(FALSE), not null
# rebased_at :datetime
# row :integer
# type :string
# value :string
2021-10-05 15:37:13 +02:00
# value_json :jsonb
# created_at :datetime
# updated_at :datetime
2022-09-15 11:27:50 +02:00
# dossier_id :integer not null
# etablissement_id :integer
# external_id :string
# parent_id :bigint
2022-09-15 11:27:50 +02:00
# type_de_champ_id :integer not null
2020-08-06 16:35:45 +02:00
#
2019-01-29 14:37:57 +01:00
class Champs::YesNoChamp < Champ
def search_terms
2019-01-29 14:37:57 +01:00
if true?
[libelle]
end
end
2018-11-06 16:20:11 +01:00
def to_s
processed_value
end
def for_tag
processed_value
end
def for_export
processed_value
2018-11-06 16:20:11 +01:00
end
2019-01-29 14:37:57 +01:00
def true?
value == 'true'
end
def for_api_v2
true? ? 'true' : 'false'
end
private
def processed_value
2019-01-29 14:37:57 +01:00
true? ? 'Oui' : 'Non'
end
2018-02-13 18:18:20 +01:00
end