Sha256: 6fb9b9b4f266532e749ab79cfa8cfaf8f78651a607529481687f5dc903762d2d

Contents?: true

Size: 541 Bytes

Versions: 6

Compression:

Stored size: 541 Bytes

Contents

module Vulgata
  module AdminHelper
    def locale_progress_percentage locale
      if TranslationState.any?
        approved_for_locale = TranslationState.where(locale: locale).where(status: Vulgata::TranslationState.statuses[:approved]).count.to_f
        sources_of_other_locales = TranslationState.where.not(locale: locale).where(status: Vulgata::TranslationState.statuses[:source]).count.to_f
        return sources_of_other_locales == 0 ? 100 : (approved_for_locale / sources_of_other_locales  * 100).floor
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vulgata-0.3.7 app/helpers/vulgata/admin_helper.rb
vulgata-0.3.6 app/helpers/vulgata/admin_helper.rb
vulgata-0.3.5 app/helpers/vulgata/admin_helper.rb
vulgata-0.3.4 app/helpers/vulgata/admin_helper.rb
vulgata-0.3.3 app/helpers/vulgata/admin_helper.rb
vulgata-0.3.1 app/helpers/vulgata/admin_helper.rb