Check show ansicht
Some checks failed
/ Run system tests (push) Waiting to run
/ Build, push and deploy image (push) Blocked by required conditions
/ Run tests (push) Has been cancelled

This commit is contained in:
david 2024-09-11 22:04:55 +02:00
parent 4f98673205
commit 29a2bd7466
9 changed files with 74 additions and 25 deletions

View file

@ -52,16 +52,26 @@ class Check < ApplicationRecord
:standard_text,
:powerpoint_text
after_create { update(number: id) }
scope(:search, lambda do |term|
# TODO: Search only fields for current locale.
joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = checks.id AND record_type = 'Check'").where("checks.name_de LIKE :term OR checks.name_de LIKE :term OR action_text_rich_texts.body LIKE :term", term: "%#{term}%").distinct
end)
def self.ransackable_attributes(auth_object = nil)
[ "applicable_to_app", "applicable_to_web", "auditory", "cognitive", "conformity_level", "created_at", "external_number", "external_url", "id", "level", "manual_test", "name", "name_de", "name_en", "number", "physical", "position", "principle_id", "priority", "test_url", "updated_at", "visual" ]
end
def self.ransackable_associations(auth_object = nil)
[ "links", "principle", "rich_text_comment", "rich_text_conformity_notice_de", "rich_text_conformity_notice_en", "rich_text_criterion_de", "rich_text_criterion_details_de", "rich_text_criterion_details_en", "rich_text_criterion_en", "rich_text_example_de", "rich_text_example_en", "rich_text_exemption_details_de", "rich_text_exemption_details_en", "rich_text_powerpoint_text_de", "rich_text_powerpoint_text_en", "rich_text_quick_criterion_de", "rich_text_quick_criterion_en", "rich_text_quick_fail_de", "rich_text_quick_fail_en", "rich_text_quick_fix_de", "rich_text_quick_fix_en", "rich_text_standard_text_de", "rich_text_standard_text_en", "rich_text_test_instructions", "standards" ]
end
def display_target_disabilities
%i[visual auditory physical cognitive].select { |d| send(:"#{d}?") }.map { |d| I18n.t("disability.#{d}") }.map(&:first).join(", ")
%i[visual auditory physical cognitive].select { |d| send(:"#{d}?") }.map { |d| I18n.t("disability.#{d}") }.join(", ")
end
def display_applicabilities
%i[applicable_to_app applicable_to_web].select { |a| send(:"#{a}?") }.map { |a| I18n.t("applicability.#{a}") }.map(&:first).join(", ")
%i[applicable_to_app applicable_to_web].select { |a| send(:"#{a}?") }.map { |a| I18n.t("applicability.#{a}") }.join(", ")
end
end