Sha256: 6ec8069bc119207f589b16895c35996a45a507e8d61c71dc4756df46e617b4b3

Contents?: true

Size: 1.61 KB

Versions: 53

Compression:

Stored size: 1.61 KB

Contents

module Presenter
  module DecRr
    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

53 entries across 53 versions & 1 rubygems

Version Path
epb_view_models-1.1.2 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.1.1 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.1.0 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.29 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.28 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.27 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.26 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.25 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.24 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.23 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.22 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.21 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.20 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.19 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.18 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.17 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.16 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.15 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.14 lib/presenter/dec_rr/recommendation_report.rb
epb_view_models-1.0.13 lib/presenter/dec_rr/recommendation_report.rb