sshaw/itunes_store_transporter_web

View on GitHub
app/views/jobs/results/_status-2.0.html.haml

Summary

Maintainability
Test Coverage
-# This is for displaying statuses returned from version >= 2.0
- content_for :results do
  .section
    %table.table.table-bordered.job-status
      - [:vendor_id, :apple_id].each do |k|
        - next unless status[k]
        %tr
          %th
            = format_option_name(k)
          %td
            = status[k]

  %h4 Content Status Info
  .section
    - if status[:content_status].nil?
      %p None
    - else
      %table.table.table-bordered.table-condensed.job-status
        - status[:content_status].each do |k, v|
          - next if k == :video_components

          - if k == :store_status
            - v.each do |k, v|
              %tr
                %th
                  &= k.to_s.titleize
                %td
                  &= v.any? ? v.join(", ") : "N/A"
          - else
            %tr
              %th
                &= k.to_s.titleize
              %td
                &= v


      %h4 Video Components
      - if status[:content_status][:video_components].nil?
        %p None
      - else
        - status[:content_status][:video_components].group_by { |v| v[:delivered].to_s }.sort_by { |date, _| date }.each do |date, videos|
          %h5
            Delivered
            = date
            - videos.each do |video|
              %table.table.table-bordered.table-condensed.job-status
                - video.each do |k, v|
                  - next if k == :delivered
                  %tr
                    %th
                      &= k.to_s.titleize
                    %td
                      &= v.nil? ? "N/A" : v

  %h4 Upload Status Info
  .section
    - if status[:info].none?
      %p None
    - else
      - status[:info].each_with_index do |stat, i|
        %table.table.table-bordered.table-condensed.job-status
          %tr
            %th
              Delivery #
            %td
              = status[:info].size - i

          - stat.each do |k, v|
            %tr
              %th
                &= k.to_s.titleize
              %td
                &= v

= partial "jobs/results/result"