Class: LandParcel
- Inherits:
-
Easement
- Object
- ActiveRecord::Base
- Ekylibre::Record::Base
- Product
- Zone
- Easement
- LandParcel
- Defined in:
- app/models/land_parcel.rb
Overview
Informations
License
Ekylibre - Simple agricultural ERP Copyright (C) 2008-2009 Brice Texier, Thibaud Merigon Copyright (C) 2010-2012 Brice Texier Copyright (C) 2012-2019 Brice Texier, David Joulin
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see www.gnu.org/licenses.
Table: products
activity_production_id :integer
address_id :integer
birth_date_completeness :string
birth_farm_number :string
born_at :datetime
category_id :integer not null
codes :jsonb
country :string
created_at :datetime not null
creator_id :integer
custom_fields :jsonb
dead_at :datetime
default_storage_id :integer
derivative_of :string
description :text
end_of_life_reason :string
father_country :string
father_identification_number :string
father_variety :string
filiation_status :string
first_calving_on :datetime
fixed_asset_id :integer
id :integer not null, primary key
identification_number :string
initial_born_at :datetime
initial_container_id :integer
initial_dead_at :datetime
initial_enjoyer_id :integer
initial_father_id :integer
initial_geolocation :geometry({:srid=>4326, :type=>"st_point"})
initial_mother_id :integer
initial_movement_id :integer
initial_owner_id :integer
initial_population :decimal(19, 4) default(0.0)
initial_shape :geometry({:srid=>4326, :type=>"multi_polygon"})
lock_version :integer default(0), not null
member_variant_id :integer
mother_country :string
mother_identification_number :string
mother_variety :string
name :string not null
nature_id :integer not null
number :string not null
origin_country :string
origin_identification_number :string
originator_id :integer
parent_id :integer
person_id :integer
picture_content_type :string
picture_file_name :string
picture_file_size :integer
picture_updated_at :datetime
reading_cache :jsonb default("{}")
team_id :integer
tracking_id :integer
type :string
updated_at :datetime not null
updater_id :integer
uuid :uuid
variant_id :integer not null
variety :string not null
work_number :string
Constant Summary
Constants included from Indicateable
Instance Method Summary collapse
- #administrative_area ⇒ Object
- #destroyable? ⇒ Boolean
- #estimated_soil_nature ⇒ Object
- #human_initial_shape_area_unit ⇒ Object
Methods inherited from Product
#activity, #activity_id, #add_content_products, #age, #available?, #best_activity_production, #born_at_in_interventions, #build_new_phase, #calculate_net_surface_area, #choose_default_name, #containeds, #container_at, #contains, #contents_name, #dead?, #dead_at_in_interventions, #dead_first_at, #default_catalog_item, #deliverable?, #evaluated_price, #get, #groups_at, #initial_reading, #initial_shape_area, #initializeable?, #localized_variants, #matching_model, miscibility_of, #move!, #nature_name, #net_surface_area, #owner, #part_with, #part_with!, #picture_path, #population, #price, #production, #read_store_attribute, #set_default_values, #set_initial_values, #shape=, #stock_info, #unroll_name, #update_default_values, #variables, #work_name
Methods included from Customizable
#custom_value, #set_custom_value, #validate_custom_fields
Methods included from Versionable
#add_creation_version, #add_destruction_version, #add_update_version, #last_version, #notably_changed?, #version_object
Methods included from Indicateable
#add_and_read, #add_to_readings, #compute_and_read, #copy_readings_of!, #density, #first_reading, #get, #get!, #mark!, #operate_on_readings, #read!, #read_whole_indicators_from!, #reading, #substract_and_read, #substract_to_readings
Methods inherited from Ekylibre::Record::Base
#already_updated?, #check_if_destroyable?, #check_if_updateable?, columns_definition, customizable?, #customizable?, #customized?, #editable?, has_picture, #human_attribute_name, nomenclature_reflections, #old_record, #others, refers_to, #unsuppress, #updateable?
Methods included from Userstamp::Stampable
Methods included from Userstamp::Stamper
Instance Method Details
#administrative_area ⇒ Object
117 118 119 120 |
# File 'app/models/land_parcel.rb', line 117 def administrative_area # TODO: Find best administrative area with its shape nil end |
#destroyable? ⇒ Boolean
107 108 109 |
# File 'app/models/land_parcel.rb', line 107 def destroyable? super && !(activity_productions.any? || analyses.any?) end |
#estimated_soil_nature ⇒ Object
122 123 124 125 |
# File 'app/models/land_parcel.rb', line 122 def estimated_soil_nature # TODO: Find estimated soil nature through analysis in this zone nil end |
#human_initial_shape_area_unit ⇒ Object
111 112 113 114 115 |
# File 'app/models/land_parcel.rb', line 111 def human_initial_shape_area_unit a = activity_productions.first.activity if activity_productions.first return nil unless a a.size_unit end |