diff options
| author | Guillaume | 2017-09-19 11:33:25 +0200 |
|---|---|---|
| committer | Guillaume | 2017-09-19 11:33:25 +0200 |
| commit | f0e348e360a5c5b940356b95e75905f9794d2332 (patch) | |
| tree | 8d3de103af3802634cb4f1de0f3b86fba07f5a02 /app | |
| parent | 47bc1f0ef1b4c1ba0db0a9e6e75f765dd2c5d88d (diff) | |
| parent | 1defcfa262845b2acd75ceac2d200f11ddf3a54e (diff) | |
| download | chouette-core-4466-compliance_control_sets.tar.bz2 | |
Merge branch 'master' into 4466-compliance_control_sets4466-compliance_control_sets
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/compliance_check_message.rb (renamed from app/models/compliance_check_result.rb) | 2 | ||||
| -rw-r--r-- | app/models/compliance_control.rb | 4 | ||||
| -rw-r--r-- | app/models/generic_attribute_min_max.rb | 27 | ||||
| -rw-r--r-- | app/views/imports/index.html.slim | 2 |
4 files changed, 32 insertions, 3 deletions
diff --git a/app/models/compliance_check_result.rb b/app/models/compliance_check_message.rb index 161e45189..86899eb15 100644 --- a/app/models/compliance_check_result.rb +++ b/app/models/compliance_check_message.rb @@ -1,4 +1,4 @@ -class ComplianceCheckResult < ActiveRecord::Base +class ComplianceCheckMessage < ActiveRecord::Base belongs_to :compliance_check belongs_to :compliance_check_resource end diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb index 685a00706..12ff4737a 100644 --- a/app/models/compliance_control.rb +++ b/app/models/compliance_control.rb @@ -2,9 +2,11 @@ class ComplianceControl < ActiveRecord::Base belongs_to :compliance_control_set belongs_to :compliance_control_block - enum criticity: [:info, :warning, :error] + extend Enumerize + enumerize :criticity, in: %i(info warning error), scope: true, default: :info validates :criticity, presence: true validates :name, presence: true validates :code, presence: true + validates :compliance_control_set, presence: true end diff --git a/app/models/generic_attribute_min_max.rb b/app/models/generic_attribute_min_max.rb new file mode 100644 index 000000000..e9a127c56 --- /dev/null +++ b/app/models/generic_attribute_min_max.rb @@ -0,0 +1,27 @@ +#module ComplianceControls + + class GenericAttributeMinMax < ComplianceControl + + + hstore_accessor :control_attributes, minimum: :integer, maximum: :integer + #attribute :minimum, type: :integer, optionnal: true + #attribute :maximum, type: :integer, optionnal: true + # #attribute :target, type: ModelAttribute + + @@default_criticity = :warning + @@default_code = "3-Generic-2" + + validate :min_max_values + def min_max_values + true + end + + after_initialize do + self.name = 'GenericAttributeMinMax' + self.code = @@default_code + self.criticity = @@default_criticity + end + + end + +#end diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim index 2203d3584..a6da730f1 100644 --- a/app/views/imports/index.html.slim +++ b/app/views/imports/index.html.slim @@ -24,7 +24,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :started_at, \ - attribute: Proc.new { |n| l(n.started_at, format: :long) }, \ + attribute: Proc.new { |n| l(n.started_at, format: :long) if n.started_at }, \ ), \ TableBuilderHelper::Column.new( \ key: :name, \ |
