Sha256: 5ee9c568c77d40b967df89e48ff23aad1fb1a8fea569e3241f2a1e3ffd256ad2

Contents?: true

Size: 769 Bytes

Versions: 10

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Letters
    class LettersInProgressComponent < ApplicationComponent
      pattr_initialize [:current_user!]

      # Note we want oldest letters ordered first here - elsewhere letters are newest first
      def letters_in_progress
        @letters_in_progress ||= begin
          present_letters(
            Letters::Letter
              .reversed
              .where("author_id = ? or created_by_id = ?", current_user.id, current_user.id)
              .in_progress
              .includes(:author, :patient, :letterhead)
          )
        end
      end

      private

      def present_letters(letters)
        CollectionPresenter.new(letters, Letters::LetterPresenterFactory)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.1.0 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.167 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.166 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.165 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.164 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.163 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.162 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.161 app/components/renalware/letters/letters_in_progress_component.rb
renalware-core-2.0.160 app/components/renalware/letters/letters_in_progress_component.rb