<commit_before># encoding: utf-8

module Carto
  class AccountType

    FREE = 'FREE'.freeze
    BASIC = 'BASIC'.freeze
    PRO = 'PRO'.freeze

    # Old plans
    MAGELLAN = 'MAGELLAN'.freeze

    NO_SOFT_GEOCODING_PLANS = 'ACADEMIC|ACADEMY|INTERNAL|FREE|AMBASSADOR|PARTNER|MAGELLAN|ENTERPRISE|ORGANIZATION|PERSONAL30'.freeze

    NO_SOFT_GEOCODING_PLANS_REGEXP = /(#{NO_SOFT_GEOCODING_PLANS})/i

    def pay_users
      ::User.where("upper(account_type) != '#{FREE}'").count
    end

    def soft_geocoding_limit?(user)
      if user[:soft_geocoding_limit].nil?
        !(user.account_type.nil? || user.account_type =~ NO_SOFT_GEOCODING_PLANS_REGEXP)
      else
        user[:soft_geocoding_limit]
      end
    end

    def soft_here_isolines_limit?(user)
      !!user[:soft_here_isolines_limit]
    end

    def soft_obs_snapshot_limit?(user)
      !!user[:soft_obs_snapshot_limit]
    end<commit_msg>Students should not get soft limits<commit_after># encoding: utf-8

module Carto
  class AccountType

    FREE = 'FREE'.freeze
    BASIC = 'BASIC'.freeze
    PRO = 'PRO'.freeze

    # Old plans
    MAGELLAN = 'MAGELLAN'.freeze

    NO_SOFT_GEOCODING_PLANS = 'ACADEMIC|ACADEMY|STUDENT|INTERNAL|FREE|AMBASSADOR|PARTNER|MAGELLAN|ENTERPRISE|ORGANIZATION|PERSONAL30'.freeze

    NO_SOFT_GEOCODING_PLANS_REGEXP = /(#{NO_SOFT_GEOCODING_PLANS})/i

    def pay_users
      ::User.where("upper(account_type) != '#{FREE}'").count
    end

    def soft_geocoding_limit?(user)
      if user[:soft_geocoding_limit].nil?
        !(user.account_type.nil? || user.account_type =~ NO_SOFT_GEOCODING_PLANS_REGEXP)
      else
        user[:soft_geocoding_limit]
      end
    end

    def soft_here_isolines_limit?(user)
      !!user[:soft_here_isolines_limit]
    end

    def soft_obs_snapshot_limit?(user)
      !!user[:soft_obs_snapshot_limit]
    end
{'fraction_non_alphanumeric': 0.10815217391304348, 'fraction_numerical': 0.003260869565217391, 'mean_word_length': 3.7448453608247423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1985318', 'n_tokens_mistral': 737, 'n_tokens_neox': 697, 'n_words': 94}