<commit_before>module Audit
  class Guild < Sequel::Model

    class << self
      def deactivate_guilds
        Guild.all.each {|g| g.set_inactive if g.days_remaining <= 0}
      end
    end

    def days_remaining
      if patreon > 0
        60
      elsif updated_at
        60 - (Date.today - updated_at.to_date).to_i
      else
        0
      end
    end

    def set_inactive
      self.active = 0
      self.save
      puts "Deactivated guild with ID #{id}"
    end
  end<commit_msg>Don't deactivate inactive guilds again<commit_after>module Audit
  class Guild < Sequel::Model

    class << self
      def deactivate_guilds
        Guild.all.each {|g| g.set_inactive if (g.days_remaining <= 0 && g.active == 1 )}
      end
    end

    def days_remaining
      if patreon > 0
        60
      elsif updated_at
        60 - (Date.today - updated_at.to_date).to_i
      else
        0
      end
    end

    def set_inactive
      self.active = 0
      self.save
      puts "Deactivated guild with ID #{id}"
    end
  end
{'fraction_non_alphanumeric': 0.0738581146744412, 'fraction_numerical': 0.01652089407191448, 'mean_word_length': 1.7913279132791329, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '6771986', 'n_tokens_mistral': 368, 'n_tokens_neox': 339, 'n_words': 95}