<commit_before>require 'yammer'
include ApplicationHelper

class Board < ActiveRecord::Base
  has_paper_trail :meta => { :board_id  => :id }

  belongs_to :user
  belongs_to :network
  has_many :initiatives, :dependent => :destroy
  has_many :teams, :dependent => :destroy
  has_many :roles, :dependent => :destroy
  has_many :people, :dependent => :destroy
  has_many :locations, :dependent => :destroy
  has_many :projects, :through => :initiatives

  validates :network_id, presence: { message: "Is user logged in?"}
  validates :name, presence: { message: "Please specify a name"}

  def ongoing_initiatives
      self.initiatives.where(completed: false).order(:created_at)
  end

  def people_ending_soon
    @people_ending_soon = []
    self.people.each do |p|
      if (p.project_members.count == 1 && p.project_members[0].end_date)
        if p.freeing_up_soon? && p.team.single_project?
          project_hash = { "person_name" => p.name,
           "project_end_date" => p.project_members[0].end_date,
           "project_name" => p.project_members[0].project.name
         }
          @people_ending_soon << project_hash
        end
      end
    end
    @people_ending_soon
  end

  def long_projects(location_name)
    self.projects.where(:completed => false).where.not(:location_id => nil).order(:start_date).select { |cp|
      !cp.initiative.standing? && project_length(cp) >= 5 && cp.location.name == location_name
    }
  end

  def has_long_projects
    self.locations.each do |l|
      if long_projects(l.name) != []
        return true
      end
    end
    return false
  end

<commit_msg>long projects should be defined by start date older than 5 weeks. don't care about end date<commit_after>require 'yammer'
include ApplicationHelper

class Board < ActiveRecord::Base
  has_paper_trail :meta => { :board_id  => :id }

  belongs_to :user
  belongs_to :network
  has_many :initiatives, :dependent => :destroy
  has_many :teams, :dependent => :destroy
  has_many :roles, :dependent => :destroy
  has_many :people, :dependent => :destroy
  has_many :locations, :dependent => :destroy
  has_many :projects, :through => :initiatives

  validates :network_id, presence: { message: "Is user logged in?"}
  validates :name, presence: { message: "Please specify a name"}

  def ongoing_initiatives
      self.initiatives.where(completed: false).order(:created_at)
  end

  def people_ending_soon
    @people_ending_soon = []
    self.people.each do |p|
      if (p.project_members.count == 1 && p.project_members[0].end_date)
        if p.freeing_up_soon? && p.team.single_project?
          project_hash = { "person_name" => p.name,
           "project_end_date" => p.project_members[0].end_date,
           "project_name" => p.project_members[0].project.name
         }
          @people_ending_soon << project_hash
        end
      end
    end
    @people_ending_soon
  end

  def long_projects(location_name)
    self.projects.where(:completed => false).where.not(:location_id => nil).order(:start_date).select { |cp|
      !cp.initiative.standing? && num_weeks(cp.start_date, Date.today) >= 5 && cp.location.name == location_name
    }
  end

  def has_long_projects
    self.locations.each do |l|
      if long_projects(l.name) != []
        return true
      end
    end
    return false
  end


{'fraction_non_alphanumeric': 0.1166365280289331, 'fraction_numerical': 0.003315250150693189, 'mean_word_length': 3.3272490221642763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, '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': '3349800', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1059, 'n_words': 243}