Sha256: ff7a22b8a3914bff65c100b71f1b145ffb185645f21d6c5f10bc4aa3b05e03d5

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

module Renalware
  module PDRegimesHelper
    def system_options_for(regime)
      PD::System.for_pd_type(regime.pd_type) { |system| [system.name, system.id] }
    end

    def therapy_times
      PD::APDRegime::VALID_RANGES.therapy_times.map do |minutes|
        [Duration.from_minutes(minutes).to_s, minutes]
      end
    end

    def bag_types
      Renalware::PD::BagType.all.map { |bt| [bt.full_description, bt.id] }
    end

    def default_daily_glucose_average(glucose)
      glucose.presence || 0
    end

    # The list of treatment options, stored in I18n
    def available_pd_treatments_for(regime)
      scope = "renalware.pd.treatments"
      key = regime.capd? ? "capd" : "apd"
      I18n.t(key, scope: scope)
    end

    def capd_apd_title(regime)
      regime.pd_type.to_s.upcase
    end

    def pd_regime_bag_days(bag)
      days = []
      Date::DAYNAMES.each_with_index do |day, index|
        days << Date::ABBR_DAYNAMES[index] if bag.public_send(day.downcase.to_sym)
      end
      days.join(", ")
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.15 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.14 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.13 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.12 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.11 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.9 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.8 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.7 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.5 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.4 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.3 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.2 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.1 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0.pre.rc13 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0.pre.rc11 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0.pre.rc10 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0.pre.rc9 app/helpers/renalware/pd_regimes_helper.rb
renalware-core-2.0.0.pre.rc8 app/helpers/renalware/pd_regimes_helper.rb