<commit_before>class Entry < ActiveRecord::Base
  belongs_to :task
  belongs_to :timesheet

  validates :description, :hours, :task_id, :presence => true
  validates_numericality_of :hours, :greater_than_or_equal_to => 0

  def editable?
    # new entry, not assigned to any task
    return true if not task.present?

    !task.project.finished
  end

  def self.hours_per_week_for_user user
    Entry.select(%{ SUM(hours) AS hours, WEEK(date, 3) AS week }).joins(:timesheet).where('timesheets.user_id = ?', user.id).group('WEEK(date, 3)')
  end
end<commit_msg>Fixed another week grouping bug.<commit_after>class Entry < ActiveRecord::Base
  belongs_to :task
  belongs_to :timesheet

  validates :description, :hours, :task_id, :presence => true
  validates_numericality_of :hours, :greater_than_or_equal_to => 0

  def editable?
    # new entry, not assigned to any task
    return true if not task.present?

    !task.project.finished
  end

  def self.hours_per_week_for_user user
    Entry.select(%{ SUM(hours) AS hours, WEEK(date, 3) AS week }).joins(:timesheet).where('timesheets.user_id = ?', user.id).group('YEARWEEK(date, 3)')
  end
end
{'fraction_non_alphanumeric': 0.11441048034934498, 'fraction_numerical': 0.005240174672489083, 'mean_word_length': 4.563106796116505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1504518', 'n_tokens_mistral': 416, 'n_tokens_neox': 386, 'n_words': 101}