<commit_before>#
# This hook copies the comment from the issue to the time entry if the latter is
# blank (when updating an issue)
#
class DiaryIssueHook < Redmine::Hook::Listener
  def controller_issues_edit_before_save(context)
    journal = context[:journal]
    time_entry = context[:time_entry]

    # Instead of creating a time entry with a blank comment, copy the first 200
    # characters from the journal (the issue comment)
    if time_entry && journal && time_entry.comments.blank?
      comments = journal.notes[0..199]
      # To be honest, a new record is not expected at this point with the
      # current redmine implementation, but just in case...
      if time_entry.new_record?
        time_entry.comments = comments
      else
        time_entry.update_attribute :comments, comments
      end
    end
    true
  end
end

<commit_msg>Copy 251 characters from the journal, instead of 200<commit_after>#
# This hook copies the comment from the issue to the time entry if the latter is
# blank (when updating an issue)
#
class DiaryIssueHook < Redmine::Hook::Listener
  def controller_issues_edit_before_save(context)
    journal = context[:journal]
    time_entry = context[:time_entry]

    # Instead of creating a time entry with a blank comment, copy the first 200
    # characters from the journal (the issue comment)
    if time_entry && journal && time_entry.comments.blank?
      comments = journal.notes[0..250]
      # To be honest, a new record is not expected at this point with the
      # current redmine implementation, but just in case...
      if time_entry.new_record?
        time_entry.comments = comments
      else
        time_entry.update_attribute :comments, comments
      end
    end
    true
  end
end


{'fraction_non_alphanumeric': 0.06460834762721555, 'fraction_numerical': 0.011435105774728416, 'mean_word_length': 3.216867469879518, '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': '625869', 'n_tokens_mistral': 486, 'n_tokens_neox': 464, 'n_words': 192}