<commit_before>module BeachApiCore
  class Flow < ApplicationRecord
    include BeachApiCore::Concerns::Screenable
    validates :name, presence: true

    belongs_to :directory

    def self.main
      find_by(main: true)
    end

    def self.full_path
      BeachApiCore::Flow.all.map(&:full_path).sort_by { |k| k[:path] }
    end

    def full_path
      path = if directory
        ids = directory.ancestry.split("/").map &:to_i
        dirs = BeachApiCore::Directory.where(id: ids).index_by &:id
        dir_path = ids.map do |id|
          dirs[id].name
        end.join("/")
        dir_path + "/#{directory.name}/#{name}.flow"
      else
        "#{name}.flow"
      end

      {path: path, id: id}
    end
  end
end<commit_msg>fix flow<commit_after>module BeachApiCore
  class Flow < ApplicationRecord
    include BeachApiCore::Concerns::Screenable
    validates :name, presence: true

    belongs_to :directory

    def self.main
      find_by(main: true)
    end

    def self.full_path
      BeachApiCore::Flow.all.map(&:full_path).sort_by { |k| k[:path] }
    end

    def full_path
      path = if directory
        ids = (directory.ancestry || "").split("/").map &:to_i
        dirs = BeachApiCore::Directory.where(id: ids).index_by &:id
        dir_path = ids.map do |id|
          dirs[id].name
        end.join("/")
        dir_path + "/#{directory.name}/#{name}.flow"
      else
        "#{name}.flow"
      end

      {path: path, id: id}
    end
  end
end
{'fraction_non_alphanumeric': 0.12863913337846988, 'fraction_numerical': 0.0, 'mean_word_length': 2.328828828828829, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4718026', 'n_tokens_mistral': 499, 'n_tokens_neox': 492, 'n_words': 109}