diff options
| author | Teddy Wing | 2017-11-09 11:34:29 +0100 | 
|---|---|---|
| committer | cedricnjanga | 2017-11-13 17:52:54 +0100 | 
| commit | 3d6b5c8a3192d255fcec73803730d4d1a08c6586 (patch) | |
| tree | 17dcc85a4bd1e9156b261cd04108be3ce29a1deb /app/models/compliance_check_set.rb | |
| parent | ef0cf7baac830d56dfcc52aaba9467a21856c51a (diff) | |
| download | chouette-core-3d6b5c8a3192d255fcec73803730d4d1a08c6586.tar.bz2 | |
ComplianceCheckSet#update_status: First incomplete version
Fill in the `#update_status` method. It should update the status of the
`ComplianceCheckSet` based on the status of its child
`ComplianceCheckResource`s.
This version doesn't work because it doesn't wait until the end of the
loop to update the status to 'successful'. But it's the right logic for
the 'failed' and 'warning' cases.
Refs #4757
Diffstat (limited to 'app/models/compliance_check_set.rb')
| -rw-r--r-- | app/models/compliance_check_set.rb | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb index 1dc02853a..bd8123b25 100644 --- a/app/models/compliance_check_set.rb +++ b/app/models/compliance_check_set.rb @@ -19,5 +19,15 @@ class ComplianceCheckSet < ActiveRecord::Base    end    def update_status +    compliance_check_resources.each do |resource| +      case resource.status +      when 'OK' +        update(status: 'successful') +      when 'ERROR' +        update(status: 'failed') +      when 'WARNING' +        update(status: 'warning') +      end +    end    end  end  | 
