Sha256: 74d12c16019b38d822f767e057b86aac21a9e5151fa5ff99934ba623d95f9efe

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module Nuntius
  class ApplicationReportlet < Trado::Reportlet
    attr_reader :template_ids

    def initialize(params)
      @template_ids = params[:template_ids]
    end

    private

    def ymds(_for_display = false)
      results.map { |r| r['ymd'] }.uniq.sort_by { |w| Date.strptime(w, '%F') }
    end

    def all_templates
      map_items(results, :template_id)
    end

    # Helper to get item for ymd, template_id
    def ymd_template_id(ymd, template_id, what)
      find_item(results, { ymd: ymd, template_id: template_id }, what)
    end

    # Arel helpers
    def templates
      Nuntius::Template.arel_table
    end

    def messages
      Nuntius::Message.arel_table
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nuntius-1.0.27 app/reportlets/nuntius/application_reportlet.rb