<commit_before>class ProfessionalDevelopmentWorkshop

  def self.normalize(data)
    result = {}

    result[:dates] = required data[:dates]
    result[:location_name_s] = required stripped data[:location_name_s]
    result[:location_address_s] = required stripped data[:location_address_s]
    result[:grade_level_s] = 'K-5'
    result[:type_s] = required enum(data[:type_s].to_s.strip, ['Public', 'Private'])
    result[:capacity_s] = required stripped data[:capacity_s]
    result[:notes_s] = stripped data[:notes_s]
    result[:section_id_s] = stripped data[:section_id_s]

    # Email and name come from the dashboard user.
    result[:email_s] = required email_address data[:email_s]
    result[:name_s] = stripped data[:name_s]

    if data[:stopped]
      result[:stopped_dt] =  Time.now.gmtime.strftime("%F %R")
    end
    
    result
  end

  def self.receipt()
    'workshop_receipt'
  end

  def self.process(data)
    {}.tap do |results|
      location = search_for_address(data['location_address_s'])
      results.merge! location.to_solr if location
    end
  end

  def self.index(data)
    data = data.dup
    data['dates_ss'] = [].tap do |results|
      data['dates'].each do |date|
        results << date['date_s'] + ", " + date['start_time_s'] + " - " + date['end_time_s']
      end
    end
    data.delete('dates')

    # Remove this until we can get dates properly formatted for Solr.
    data.delete('stopped_dt')

    data
  end
<commit_msg>Added first date to Solr index.<commit_after>class ProfessionalDevelopmentWorkshop

  def self.normalize(data)
    result = {}

    result[:dates] = required data[:dates]
    result[:location_name_s] = required stripped data[:location_name_s]
    result[:location_address_s] = required stripped data[:location_address_s]
    result[:grade_level_s] = 'K-5'
    result[:type_s] = required enum(data[:type_s].to_s.strip, ['Public', 'Private'])
    result[:capacity_s] = required stripped data[:capacity_s]
    result[:notes_s] = stripped data[:notes_s]
    result[:section_id_s] = stripped data[:section_id_s]

    # Email and name come from the dashboard user.
    result[:email_s] = required email_address data[:email_s]
    result[:name_s] = stripped data[:name_s]

    if data[:stopped]
      result[:stopped_dt] =  Time.now.gmtime.strftime("%F %R")
    end
    
    result
  end

  def self.receipt()
    'workshop_receipt'
  end

  def self.process(data)
    {}.tap do |results|
      location = search_for_address(data['location_address_s'])
      results.merge! location.to_solr if location
    end
  end

  def self.index(data)
    data = data.dup

    data['dates_ss'] = [].tap do |results|
      data['dates'].each do |date|
        results << date['date_s'] + ", " + date['start_time_s'] + " - " + date['end_time_s']
      end
    end

    if first_date = data['dates'].first
      datetime = first_date['date_s'] + ' ' + first_date['start_time_s']
      data['first_date_dt'] = Chronic.parse(datetime).strftime('%FT%TZ')
    end

    data.delete('dates')

    # Remove this until we can get dates properly formatted for Solr.
    data.delete('stopped_dt')

    data
  end

{'fraction_non_alphanumeric': 0.13178786916481422, 'fraction_numerical': 0.0006351222610352493, 'mean_word_length': 3.5323741007194243, 'pattern_counts': {'":': 0, '<': 7, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4497865', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1020, 'n_words': 224}