Sha256: 51c48e688bb7c14f50cfc6132f5cd705886b563b43993096dca2aaff46be13ab

Contents?: true

Size: 1.61 KB

Versions: 47

Compression:

Stored size: 1.61 KB

Contents

module Presenter
  module CepcRr
    class RecommendationReport
      def initialize(view_model)
        @view_model = view_model
      end

      def to_hash
        {
          assessment_id: @view_model.assessment_id,
          recommendations: [
            @view_model.short_payback_recommendations.map do |recommendation|
              {
                payback_type: "short",
                recommendation_code: recommendation[:code],
                recommendation: recommendation[:text],
                cO2_Impact: recommendation[:cO2Impact],
              }
            end,
            @view_model.medium_payback_recommendations.map do |recommendation|
              {
                payback_type: "medium",
                recommendation_code: recommendation[:code],
                recommendation: recommendation[:text],
                cO2_Impact: recommendation[:cO2Impact],
              }
            end,
            @view_model.long_payback_recommendations.map do |recommendation|
              {
                payback_type: "long",
                recommendation_code: recommendation[:code],
                recommendation: recommendation[:text],
                cO2_Impact: recommendation[:cO2Impact],
              }
            end,
            @view_model.other_recommendations.map do |recommendation|
              {
                payback_type: "other",
                recommendation_code: recommendation[:code],
                recommendation: recommendation[:text],
                cO2_Impact: recommendation[:cO2Impact],
              }
            end,
          ].flatten,
        }
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
epb_view_models-2.0.5 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-2.0.4 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-2.0.3 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-2.0.2 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-2.0.1 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-2.0.0 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.2.3 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.2.2 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.2.1 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.2.0 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.6 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.5 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.4 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.3 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.2 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.1 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.1.0 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.0.29 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.0.28 lib/presenter/cepc_rr/recommendation_report.rb
epb_view_models-1.0.27 lib/presenter/cepc_rr/recommendation_report.rb