class AppSessionNeedsReviewComponent
Public Class Methods
Source
# File app/components/app_session_needs_review_component.rb, line 4 def initialize(session) @session = session end
Public Instance Methods
Source
# File app/components/app_session_needs_review_component.rb, line 8 def call render AppWarningCalloutComponent.new(heading: "Needs review", level: 2) do tag.ul do safe_join( items.map do |item| tag.li { link_to(item[:text].call, item[:href].call) } end ) end end end
Source
# File app/components/app_session_needs_review_component.rb, line 32 def children_without_nhs_number count = patients.without_nhs_number.count return if count.zero? { text: -> { t("children_without_nhs_number", count:) }, href: -> { session_patients_path(session, missing_nhs_number: true) } } end
Source
# File app/components/app_session_needs_review_component.rb, line 28 def items @items ||= [children_without_nhs_number, unmatched_responses].compact end
Source
# File app/components/app_session_needs_review_component.rb, line 20 def render? = items.present? private attr_reader :session delegate :patients, to: :session def items @items ||= [children_without_nhs_number, unmatched_responses].compact end def children_without_nhs_number count = patients.without_nhs_number.count return if count.zero? { text: -> { t("children_without_nhs_number", count:) }, href: -> { session_patients_path(session, missing_nhs_number: true) } } end def unmatched_responses count = ConsentForm.for_session(session).unmatched.count return if count.zero? { text: -> { t("unmatched_responses", count:) }, href: -> { consent_forms_path(session_slug: @session.slug) } } end end
Source
# File app/components/app_session_needs_review_component.rb, line 42 def unmatched_responses count = ConsentForm.for_session(session).unmatched.count return if count.zero? { text: -> { t("unmatched_responses", count:) }, href: -> { consent_forms_path(session_slug: @session.slug) } } end