2024-09-05 22:54:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-07-16 20:22:59 +02:00
|
|
|
class SuccessCriterion < ApplicationRecord
|
2024-10-31 23:13:18 +01:00
|
|
|
belongs_to :element, touch: true
|
|
|
|
|
belongs_to :check, optional: true
|
2024-07-19 02:29:18 +02:00
|
|
|
|
2024-10-31 23:13:18 +01:00
|
|
|
has_rich_text :test_comment
|
|
|
|
|
has_rich_text :quick_criterion
|
|
|
|
|
has_rich_text :quick_fail
|
|
|
|
|
has_rich_text :quick_fix
|
2024-07-19 02:29:18 +02:00
|
|
|
|
2024-10-31 23:13:18 +01:00
|
|
|
delegate :page, :report, to: :element
|
|
|
|
|
|
|
|
|
|
enum :result, %i[passed failed not_applicable]
|
|
|
|
|
enum :level, %i[A AA AAA]
|
2024-07-26 00:59:00 +02:00
|
|
|
|
|
|
|
|
def level_value
|
|
|
|
|
return nil unless level
|
|
|
|
|
|
|
|
|
|
self.class.levels.values.index_of(level)
|
|
|
|
|
end
|
2024-10-31 23:13:18 +01:00
|
|
|
|
|
|
|
|
def header
|
|
|
|
|
"HEADER"
|
|
|
|
|
end
|
2024-07-16 20:22:59 +02:00
|
|
|
end
|