<commit_before>class Activity < ActiveRecord::Base

	belongs_to :goal
	# has_many :comments, as: :commentable, dependent: :destroy
	delegate :user, to: :goal

  def complete?
    self.status == 1
  end

  def incomplete?
    status == 0
  end

  def activity_range
  	# we want to calculate the number of days between the start of
  	# an activity (created_at) and the en of the goal (due_date)
  	(self.goal.due_date - self.created_at.to_date).to_i
  end

  # find out what is the activity period (daily, weekly, monthly)
  # converting periods in days (daily = 7)
  # checking the frequency, then multiplying the frequency by the period (frequency= 3, period= weekly) to get the
  # of times the activity must be completed

  # converting the period column to a integer day ( weekly = 7, monthly = 30)
  def convert_period_to_time
  	case self.period
  	when "daily"
  		time = 1
  	when "weekly"
  		time = 7
  	when "monthly"
  		time = 30
  	when "yearly"
  		time = 365
  	end
  	time
  end

  # define how many time an activity is going to occur within the range
  def periods_in_range
  	activity_range / convert_period_to_time
  end

  def number_occurences
  	self.frequency * time_unit
  end

end
<commit_msg>set up frequency and occurence"<commit_after>class Activity < ActiveRecord::Base

	belongs_to :goal
	# has_many :comments, as: :commentable, dependent: :destroy
	delegate :user, to: :goal

  def complete?
    self.status == 1
  end

  def incomplete?
    status == 0
  end

  def activity_range
  	# we want to calculate the number of days between the start of
  	# an activity (created_at) and the en of the goal (due_date)
  	(self.goal.due_date - self.created_at.to_date).to_i
  end

  # find out what is the activity period (daily, weekly, monthly)
  # converting periods in days (daily = 7)
  # checking the frequency, then multiplying the frequency by the period (frequency= 3, period= weekly) to get the
  # of times the activity must be completed

  # converting the period column to a integer day ( weekly = 7, monthly = 30)
  def convert_period_to_time
  	case self.period
  	when "daily"
  		time = 1
  	when "weekly"
  		time = 7
  	when "monthly"
  		time = 30
  	when "yearly"
  		time = 365
  	end
  	time
  end

  # define how many time an activity is going to occur within the range
  def periods_in_range
  	activity_range / convert_period_to_time
  end

  def number_occurences
  	self.frequency * time_unit
  end



end

{'fraction_non_alphanumeric': 0.06544715447154471, 'fraction_numerical': 0.011382113821138212, 'mean_word_length': 3.1641285956006766, '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': '6680800', 'n_tokens_mistral': 854, 'n_tokens_neox': 787, 'n_words': 306}