<commit_before># Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def event_length(e)
    if (e.end - e.start) / 60 / 60 < 12
      return distance_of_time_in_words(e.start, e.end)
    end
      
    # count midnights, rule of thumb is "x days" where x = midnights + 1
    
    if e.start.at_beginning_of_day == e.end.at_beginning_of_day
      midnights = 0
    else
      midnights = (e.end.at_beginning_of_day - e.start.at_beginning_of_day) / 60 / 60 / 24
    end
    
    days = midnights + 1
    return "#{pluralize days.round, "days"}"
  end
  <commit_msg>Bugfix: don't error out on nil start datetime<commit_after># Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def event_length(e)
    return "(Unscheduled)" if e.length.nil?

    if e.length / 60 / 60 < 12
      return distance_of_time_in_words(e.start, e.end)
    end
      
    # count midnights, rule of thumb is "x days" where x = midnights + 1
    
    if e.start.at_beginning_of_day == e.end.at_beginning_of_day
      midnights = 0
    else
      midnights = (e.end.at_beginning_of_day - e.start.at_beginning_of_day) / 60 / 60 / 24
    end
    
    days = midnights + 1
    return "#{pluralize days.round, "days"}"
  end
  
{'fraction_non_alphanumeric': 0.08751902587519025, 'fraction_numerical': 0.0228310502283105, 'mean_word_length': 2.6629526462395545, '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': '6323557', 'n_tokens_mistral': 493, 'n_tokens_neox': 457, 'n_words': 134}