<commit_before>class Conclave::EventsController < ApplicationController
  include GG
  layout "application", :except => :map
  before_filter :find_event, :only => [:show, :map]
  before_filter :set_dates_for_navigation, :except => [:map]
  
  def index
    get_events_by_date(["start_date >= ?", Date.today])
  end

  def show
    generate_map
  end
  
  def date    
    month_first_day = Date.civil(@year, @month, @day)
    month_last_day = Date.civil(@year, @month, @day)      
    get_events_by_date(['(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', 
                         month_first_day, month_last_day, month_first_day, month_last_day])
  end
  
  def calendar_navigation
    respond_to do |format| 
      format.html { render :partial => "calendar", :locals => {:year => @year, :month => @month}}
    end
  end  
  
  def tag
    @tag  =  params[:tag]
    @events = Event.find_tagged_with(params[:tag])
  end

  def map
    generate_map
  end 
  
  private
  
    def generate_map
      return if !@event.venue_address
      loc = gg.locate @event.venue_address
      @map = GMap.new("map_div_id")
      @map.control_init(:large_map => true, :map_type => true)
      @map.center_zoom_init([loc.latitude, loc.longitude],14)
      marker = GMarker.new([loc.latitude,loc.longitude],
               :title => @event.title,
               :info_window => (@event.venue_address ? loc.address : "#{loc.address} *specified address unknown")) 
      @map.overlay_init(marker)
    end<commit_msg>doesn't fail if event's address can't be located in google maps<commit_after>class Conclave::EventsController < ApplicationController
  include GG
  layout "application", :except => :map
  before_filter :find_event, :only => [:show, :map]
  before_filter :set_dates_for_navigation, :except => [:map]
  
  def index
    get_events_by_date(["start_date >= ?", Date.today])
  end

  def show
    generate_map
  end
  
  def date    
    month_first_day = Date.civil(@year, @month, @day)
    month_last_day = Date.civil(@year, @month, @day)      
    get_events_by_date(['(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', 
                         month_first_day, month_last_day, month_first_day, month_last_day])
  end
  
  def calendar_navigation
    respond_to do |format| 
      format.html { render :partial => "calendar", :locals => {:year => @year, :month => @month}}
    end
  end  
  
  def tag
    @tag  =  params[:tag]
    @events = Event.find_tagged_with(params[:tag])
  end

  def map
    generate_map
  end 
  
  private
  
    def generate_map
      return if !@event.venue_address || @event.venue_address == ''
      loc = gg.locate @event.venue_address
      @map = GMap.new("map_div_id")
      @map.control_init(:large_map => true, :map_type => true)
      @map.center_zoom_init([loc.latitude, loc.longitude],14)
      marker = GMarker.new([loc.latitude,loc.longitude],
               :title => @event.title,
               :info_window => (@event.venue_address ? loc.address : "#{loc.address} *specified address unknown")) 
      @map.overlay_init(marker)
      
    rescue
      @map = nil
    end
{'fraction_non_alphanumeric': 0.1278812756551942, 'fraction_numerical': 0.0012630249447426586, 'mean_word_length': 2.964956195244055, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, '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': '6262070', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1042, 'n_words': 225}