<commit_before>class Milestone < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    name :string
    date :date
    description :text
    background_color :string
    color         :string, :default => '#000000'
    timestamps
  end

  belongs_to :project
  has_many :items

  default_scope :order => 'date ASC'
  scope :current, lambda { |*args |{:conditions => [ "date > ?", (args.first || Date.today - 14.days) ] }}
  scope :future,  lambda { |*args |{:conditions => [ "date > ?", (args.first || Date.today) ] }}

  validates_presence_of :date

  # --- Permissions --- #

  def create_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def update_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def destroy_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def view_permitted?(field)
    ProjectMember.view_memberships.include?(project_id)
  end

end
<commit_msg>allow add tasks to today-ish milestones<commit_after>class Milestone < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    name :string
    date :date
    description :text
    background_color :string
    color         :string, :default => '#000000'
    timestamps
  end

  belongs_to :project
  has_many :items

  default_scope :order => 'date ASC'
  scope :current, lambda { |*args |{:conditions => [ "date > ?", (args.first || Date.today - 14.days) ] }}
  scope :future,  lambda { |*args |{:conditions => [ "date > ?", (args.first || Date.today - 3.days) ] }}

  validates_presence_of :date

  # --- Permissions --- #

  def create_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def update_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def destroy_permitted?
    ProjectMember.memberships.include?(project_id)
  end

  def view_permitted?(field)
    ProjectMember.view_memberships.include?(project_id)
  end

end

{'fraction_non_alphanumeric': 0.11803781297904957, 'fraction_numerical': 0.008686765457332652, 'mean_word_length': 3.5219399538106235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '775945', 'n_tokens_mistral': 667, 'n_tokens_neox': 624, 'n_words': 146}