<commit_before>class TasksController < ApplicationController
  before_filter :check_loggedin
  def new
  end
  def create
  	@task=Task.new(params[:user])
    @task.user_id=@user.id;
    if @task.save!
      # @user.shared_lists.all(:joins=>"inner join tasks t ",:select=>"tasks.*,position",:group=>:position)
      @task=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:conditions => "tasks.id = #{@task.id} and task_shares.user_id=#{@user.id}")
      # @accessible_tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position")
      render :partial => @task
    else
      render :text =>'failed'
    end
  end
  def index
  	#@tasks=@user.tasks
    if @user
      search_text=params[:search]
      @search_text=params[:search]
      if search_text.nil?
        search_text=''
      end
      if params[:completed]=="true"
        # @tasks=@user.tasks.find_all_by_status(1).sort_by(&:"id").reverse
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 1 and tasks.name LIKE '%#{search_text}%'")
        @tab="completed"
      else
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 0 and tasks.name LIKE '%#{search_text}%'")
        # @tab="completed"
        # @tasks=@user.shared_tasks.find_all_by_status(0).sort_by(&:"id").reverse
        @tab="home"
      end
       @tasks= @tasks.paginate(:page => params[:page], :per_page => 8,:order=> "id DESC")
       # render :text => @tasks.class
       # render :text => @tasks[1].position
       # render :layout =>:index
    end

  end
  def task_list
    search_text=params[:search]
    if search_text.nil?
      search_text=''
    end
    if @tab=="completed"
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 1 and tasks.name LIKE '#{search_text}%'")
    else
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 0 and tasks.name LIKE '#{search_text}%'")
    end
    @tasks= @tasks.paginate(:page => params[:page], :per_page => 8,:order=> "position DESC")<commit_msg>integer to boolean<commit_after>class TasksController < ApplicationController
  before_filter :check_loggedin
  def new
  end
  def create
  	@task=Task.new(params[:user])
    @task.user_id=@user.id;
    if @task.save!
      # @user.shared_lists.all(:joins=>"inner join tasks t ",:select=>"tasks.*,position",:group=>:position)
      @task=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:conditions => "tasks.id = #{@task.id} and task_shares.user_id=#{@user.id}")
      # @accessible_tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position")
      render :partial => @task
    else
      render :text =>'failed'
    end
  end
  def index
  	#@tasks=@user.tasks
    if @user
      search_text=params[:search]
      @search_text=params[:search]
      if search_text.nil?
        search_text=''
      end
      if params[:completed]=="true"
        # @tasks=@user.tasks.find_all_by_status(1).sort_by(&:"id").reverse
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = true and tasks.name LIKE '%#{search_text}%'")
        @tab="completed"
      else
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = false and tasks.name LIKE '%#{search_text}%'")
        # @tab="completed"
        # @tasks=@user.shared_tasks.find_all_by_status(0).sort_by(&:"id").reverse
        @tab="home"
      end
       @tasks= @tasks.paginate(:page => params[:page], :per_page => 8,:order=> "id DESC")
       # render :text => @tasks.class
       # render :text => @tasks[1].position
       # render :layout =>:index
    end

  end
  def task_list
    search_text=params[:search]
    if search_text.nil?
      search_text=''
    end
    if @tab=="completed"
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 1 and tasks.name LIKE '#{search_text}%'")
    else
        @tasks=@user.shared_tasks.all(:select => "DISTINCT(task_shares.task_id),task_shares.position,tasks.*",:joins => 'INNER  JOIN task_shares ts  ON task_shares.task_id = tasks.id',:order => "task_shares.position DESC",:conditions => "status = 0 and tasks.name LIKE '#{search_text}%'")
    end
    @tasks= @tasks.paginate(:page => params[:page], :per_page => 8,:order=> "position DESC")
{'fraction_non_alphanumeric': 0.16577000672494957, 'fraction_numerical': 0.0026899798251513113, 'mean_word_length': 4.177545691906006, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, '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': '1347167', 'n_tokens_mistral': 2139, 'n_tokens_neox': 2092, 'n_words': 351}