<commit_before>class ProfileController < ApplicationController
  before_filter :get_current_user

  def index
    if not @current_user.nil? and (params[:login] == @current_user.login or params[:login].nil?)
      @profile = @current_user
    else
      @profile = User.find_by_login_and_public(params[:login], true)
    end
    if @profile.nil?
      flash[:notice] = "Profile not found!"
      redirect_to :controller => 'search'
      return
    end
    # Respond
    respond_to do |format|
      format.html {
        # Get emissions data
        @period = report_period
        @pie_url = ratio_chart_user_report_path(@profile, :format => :xmlchart, :period => @period)
        @line_url = recent_chart_user_report_path(@profile, :format => :amline, :period => @period)
        @line_settings_url = recent_chart_user_report_path(@profile, :format => :amline_settings, :period => @period)
        @show_flight_controls = @profile.flights.count > 0 ? true : false;
        @totals = @profile.calculate_totals(@period)
        # Get comments
        @comments = @profile.comments.find(:all, :limit => 5)
        # Get actions
        @actions = get_actions(3) if @profile == @current_user
      }
      format.iphone { render_iphone }
      format.wml
    end
  end

  def feed
    @user = User.find_by_guid(params[:id])
    @comments = @user.comments.find(:all, :order => "created_at DESC", :limit => 10)
    # Send data
    headers["Content-Type"] = "application/atom+xml"
    render :action => 'atom.rxml', :layout => false
  end

private

  def report_period
    days = Date::today - @profile.date_of_first_data
    return days < 365 ? days : 365
  end
  
end
<commit_msg>Fix daft redirect to search if login profile param is nil.<commit_after>class ProfileController < ApplicationController
  before_filter :get_current_user

  def index
    if not @current_user.nil? and (params[:login] == @current_user.login or params[:login].nil?)
      @profile = @current_user
    else
      @profile = User.find_by_login_and_public(params[:login], true)
    end
    if @profile.nil?
      if params[:login].present?
        flash[:notice] = "Profile not found!"
        redirect_to :controller => 'search'
      else
        redirect_to '/'
      end
      return
    end
    # Respond
    respond_to do |format|
      format.html {
        # Get emissions data
        @period = report_period
        @pie_url = ratio_chart_user_report_path(@profile, :format => :xmlchart, :period => @period)
        @line_url = recent_chart_user_report_path(@profile, :format => :amline, :period => @period)
        @line_settings_url = recent_chart_user_report_path(@profile, :format => :amline_settings, :period => @period)
        @show_flight_controls = @profile.flights.count > 0 ? true : false;
        @totals = @profile.calculate_totals(@period)
        # Get comments
        @comments = @profile.comments.find(:all, :limit => 5)
        # Get actions
        @actions = get_actions(3) if @profile == @current_user
      }
      format.iphone { render_iphone }
      format.wml
    end
  end

  def feed
    @user = User.find_by_guid(params[:id])
    @comments = @user.comments.find(:all, :order => "created_at DESC", :limit => 10)
    # Send data
    headers["Content-Type"] = "application/atom+xml"
    render :action => 'atom.rxml', :layout => false
  end

private

  def report_period
    days = Date::today - @profile.date_of_first_data
    return days < 365 ? days : 365
  end
  
end

{'fraction_non_alphanumeric': 0.11806952025280092, 'fraction_numerical': 0.006320022981901752, 'mean_word_length': 3.0022988505747126, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4537920', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1069, 'n_words': 255}