<commit_before>class MemoryCardsController < ApplicationController
  helper_method :show
  
  def index
   if (params[:category] == "All Categories" || params[:category] == "all")
     @memorycards = MemoryCard.all
   elsif(params[:category])
     @memorycards = MemoryCard.where(:user_id => session[:user_id], :category => params[:category])
   else
     @memorycards = MemoryCard.all
   end
   @category = params[:category] || "All Categories"
 end
  
  # def index
  #   puts params, "JAJAJAJA"
  #   puts session[:user_id]
  #   @memorycards = MemoryCard.where(:user_id => session[:user_id] )
  # end
  
  def edit
    # puts params
    @memcard = MemoryCard.find(params[:id])
    @memcard.editing = true
    @memcard.save
    redirect_to memory_cards_path
  end
  
  def update
    # puts params, "QQQQ"
    @memcard = MemoryCard.find(params[:id])
    @memcard.editing = false
    if params["user"].nil? == false
      @memcard.answer = params["user"]["memory"]
    end
    @memcard.save
    redirect_to memory_cards_path
  end
  
  def show
  end 

  def save
  end

  def exit
  end
end
<commit_msg>only cards with given category are correctly shown<commit_after>class MemoryCardsController < ApplicationController
  helper_method :show
  
  def index
   if (params[:category] == "All Categories" || params[:category] == "all")
     @memorycards = MemoryCard.all
   elsif(params[:category])
     @memorycards = MemoryCard.where(:user_id => session[:user_id], :category => params[:category])
   else
     @memorycards = MemoryCard.all
   end
   @category = params[:category] || "All Categories"
 end
  

  
  def edit
    # puts params
    @memcard = MemoryCard.find(params[:id])
    @memcard.editing = true
    @memcard.save
    redirect_to memory_cards_path
  end
  
  def update
    # puts params, "QQQQ"
    @memcard = MemoryCard.find(params[:id])
    @memcard.editing = false
    if params["user"].nil? == false
      @memcard.answer = params["user"]["memory"]
    end
    @memcard.save
    redirect_to memory_cards_path
  end
  
  def show
  end 

  def save
  end

  def exit
  end
end

{'fraction_non_alphanumeric': 0.11624583134826108, 'fraction_numerical': 0.0, 'mean_word_length': 3.191616766467066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '6708066', 'n_tokens_mistral': 690, 'n_tokens_neox': 680, 'n_words': 160}