Sha256: 74bebfa087aa438164996815b4d67c45ed05512ac2368906f4acf8d42dddabb9

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::ParticipantXlsxDecorator < Tramway::Export::Xlsx::ApplicationDecorator
  class << self
    def columns
      %i[full_name email phone organization event].map do |attribute|
        { Tramway::Event::Participant.human_attribute_name(attribute).to_sym => attribute }
      end
    end

    def filename
      'participants.xlsx'
    end
  end

  def full_name
    return unless object.values

    "#{object.values['Фамилия'] || object.values['Фамилия ']} #{object.values['Имя'] || object.values['Имя ']}"
  end

  def email
    return unless object.values

    object.values['Email']
  end

  def phone
    return unless object.values

    object.values['Телефон']
  end

  def organization
    return unless object.values

    object.values['Место работы/ Учебное заведение']
  end

  def event
    object.event.title
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tramway-event-1.9.28.2 app/decorators/tramway/event/participant_xlsx_decorator.rb
tramway-event-1.9.28.1 app/decorators/tramway/event/participant_xlsx_decorator.rb