<commit_before>class UsersController < ApplicationController
	include SessionsHelper

  def index
    redirect_to root_url
  end

  def show
    # Users must be signed in to view a profile
    # redirect_to signin_url if !signed_in?

    @user = User.find_by_account_name params[:id]
    unless @user
      Rails.logger.info 'Could not locate user '
      return render :status => 404
    end

    @is_admin = (signed_in? and @user.is_admin?(@current_user))
  	# Rails.logger.info "IS ADMIN? #{@is_admin}"

    @maps = @user.maps
    @resources = @user.resources.paginate(page: params[:page]).order('id DESC')
    @num_of_pages = @user.total_resources_count / 20 + 2

    @filter_course_types = ResourceType.where( id: @user.resources.collect { |resource| resource.resource_type.id } )
    @filter_course_grades = CourseGrade.where( id: @user.resources.collect { |resource| resource.course_grades.collect(&:id) } )
    @filter_course_subjects = CourseSubject.where( id: @user.resources.collect { |resource| resource.course_subjects.collect(&:id) } )

    # For rendering Ajax "Upload Resource" form
    @resource = Resource.new

  end

  def new
    redirect_to @current_user if signed_in?<commit_msg>enabled users profiles to show only 'public' maps<commit_after>class UsersController < ApplicationController
	include SessionsHelper

  def index
    redirect_to root_url
  end

  def show
    # Users must be signed in to view a profile
    # redirect_to signin_url if !signed_in?

    @user = User.find_by_account_name params[:id]
    unless @user
      Rails.logger.info 'Could not locate user '
      return render :status => 404
    end

    @is_admin = (signed_in? and @user.is_admin?(@current_user))
  	# Rails.logger.info "IS ADMIN? #{@is_admin}"

    if @is_admin
    	@maps = @user.maps
    else
    	@maps = @user.maps.where("privacy_state = #{PrivacyState::PUBLIC}")
    end

    @resources = @user.resources.paginate(page: params[:page]).order('id DESC')
    @num_of_pages = @user.total_resources_count / 20 + 2

    @filter_course_types = ResourceType.where( id: @user.resources.collect { |resource| resource.resource_type.id } )
    @filter_course_grades = CourseGrade.where( id: @user.resources.collect { |resource| resource.course_grades.collect(&:id) } )
    @filter_course_subjects = CourseSubject.where( id: @user.resources.collect { |resource| resource.course_subjects.collect(&:id) } )

    # For rendering Ajax "Upload Resource" form
    @resource = Resource.new

  end

  def new
    redirect_to @current_user if signed_in?
{'fraction_non_alphanumeric': 0.10914801727522576, 'fraction_numerical': 0.004711425206124852, 'mean_word_length': 3.844106463878327, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '109753', 'n_tokens_mistral': 830, 'n_tokens_neox': 788, 'n_words': 195}