<commit_before>class UsersController < ApplicationController
  before_filter :authenticate_user!, :only => [:edit]
  
  def show
    @user = User.where(:username => params[:id]).first
    @trips = @user.trips.order("start DESC")
    @hitchhikes   = @user.trips.collect{|trip| trip.hitchhikes}.flatten
    @total_distance = @user.trips.collect{|trip| trip.distance if trip.distance > 0}.compact.sum / 1000
    @waiting_time_array = @hitchhikes.collect{|hitchhike| hitchhike.waiting_time}.flatten.compact
    @total_waiting_time   = @waiting_time_array.sum
    @average_waiting_time = @total_waiting_time / @waiting_time_array.size unless @waiting_time_array.size == 0    
    @stories = @hitchhikes.collect{|h| h.story}.compact.delete_if{|x| x == ''}
    @number_of_photos = @hitchhikes.collect{|h| h.photo.file? }.delete_if{|x| x==false}.compact.size
    @longest_trip = @trips[@trips.index{|x| x.distance==@trips.collect{|t| t.distance}.max}] unless @trips.empty?
    
    avg_drivers_age_array = @hitchhikes.collect{|h| h.person.age if h.person}.compact
    @avg_drivers_age = avg_drivers_age_array.sum / avg_drivers_age_array.size unless avg_drivers_age_array.size == 0    
  end
  
  def edit
    @trips = current_user.trips
  end
  
  def index
    @users = User.all
  end
end<commit_msg>sort Hitchhikers after usernames<commit_after>class UsersController < ApplicationController
  before_filter :authenticate_user!, :only => [:edit]
  
  def show
    @user = User.where(:username => params[:id]).first
    @trips = @user.trips.order("start DESC")
    @hitchhikes   = @user.trips.collect{|trip| trip.hitchhikes}.flatten
    @total_distance = @user.trips.collect{|trip| trip.distance if trip.distance > 0}.compact.sum / 1000
    @waiting_time_array = @hitchhikes.collect{|hitchhike| hitchhike.waiting_time}.flatten.compact
    @total_waiting_time   = @waiting_time_array.sum
    @average_waiting_time = @total_waiting_time / @waiting_time_array.size unless @waiting_time_array.size == 0    
    @stories = @hitchhikes.collect{|h| h.story}.compact.delete_if{|x| x == ''}
    @number_of_photos = @hitchhikes.collect{|h| h.photo.file? }.delete_if{|x| x==false}.compact.size
    @longest_trip = @trips[@trips.index{|x| x.distance==@trips.collect{|t| t.distance}.max}] unless @trips.empty?
    
    avg_drivers_age_array = @hitchhikes.collect{|h| h.person.age if h.person}.compact
    @avg_drivers_age = avg_drivers_age_array.sum / avg_drivers_age_array.size unless avg_drivers_age_array.size == 0    
  end
  
  def edit
    @trips = current_user.trips
  end
  
  def index
    @users = User.order('users.username ASC').all
  end
end
{'fraction_non_alphanumeric': 0.13444739840486136, 'fraction_numerical': 0.005317128750474744, 'mean_word_length': 4.321212121212121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3292628', 'n_tokens_mistral': 1027, 'n_tokens_neox': 952, 'n_words': 151}