<commit_before>require 'pry'
class ProgressUpdate < ApplicationRecord
  belongs_to :project
  belongs_to :user
  has_many :comments, dependent: :destroy

  def self.add_and_update_project(params, word_format, project)
    update = self.new
    update.project = project
    if word_format == "new"
      update.project.words += params[:words].to_i
      words_added = params[:words].to_i
    else
      update.project.words = params[:words].to_i
      words_added = update.project.words - params[:words].to_i
    end

    update.project.hours += params[:hours].to_f
    update.content = params[:content]
    update.words = words_added
    update.hours = params[:hours].to_f
    update
  end
end<commit_msg>Add full_errors_string method. Validate presence of content<commit_after>require 'pry'
class ProgressUpdate < ApplicationRecord
  belongs_to :project
  belongs_to :user
  has_many :comments, dependent: :destroy

  validates :content, presence: true

  def self.add_and_update_project(params, word_format, project)
    update = self.new
    update.project = project
    if word_format == "new"
      update.project.words += params[:words].to_i
      words_added = params[:words].to_i
    else
      update.project.words = params[:words].to_i
      words_added = update.project.words - params[:words].to_i
    end

    update.project.hours += params[:hours].to_f
    update.content = params[:content]
    update.words = words_added
    update.hours = params[:hours].to_f
    update
  end

  def full_errors_string
    self.errors.full_messages.join(". ")
  end

end
{'fraction_non_alphanumeric': 0.10204081632653061, 'fraction_numerical': 0.0, 'mean_word_length': 3.561046511627907, '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': '790185', 'n_tokens_mistral': 489, 'n_tokens_neox': 479, 'n_words': 105}