<commit_before>class Spree::Admin::NavigationsController < Spree::Admin::BaseController
  def index
    @navigation = Spree::Navigation.all
  end
  def new
    @navigation = Spree::Navigation.new
  end
  
  def create
    Spree::Navigation.create!(params[:navigation])
    params[:navigation][:url] =  params[:navigation][:url].split("//").last
    navigation = Spree::Navigation.create!(params[:navigation])
    if params[:lang] == "pl"
      navigation.translations.where(locale: "en").first.update_attribute('name', "") if navigation.translations.where(locale: "en").first
      translation =  navigation.translations.create(locale: params[:lang], name: params[:navigation][:name])
    end
    flash[:notice] = "Navigation created successfully"
    redirect_to admin_navigations_path
  end
  
  def edit
    @navigation = Spree::Navigation.find(params[:id])
  end
  <commit_msg>Restricted twice creation of Navigations<commit_after>class Spree::Admin::NavigationsController < Spree::Admin::BaseController
  def index
    @navigation = Spree::Navigation.all
  end
  def new
    @navigation = Spree::Navigation.new
  end
  
  def create
    params[:navigation][:url] =  params[:navigation][:url].split("//").last
    navigation = Spree::Navigation.create!(params[:navigation])
    if params[:lang] == "pl"
      navigation.translations.where(locale: "en").first.update_attribute('name', "") if navigation.translations.where(locale: "en").first
      translation =  navigation.translations.create(locale: params[:lang], name: params[:navigation][:name])
    end
    flash[:notice] = "Navigation created successfully"
    redirect_to admin_navigations_path
  end
  
  def edit
    @navigation = Spree::Navigation.find(params[:id])
  end
  
{'fraction_non_alphanumeric': 0.13981588032220943, 'fraction_numerical': 0.0, 'mean_word_length': 4.739273927392739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6955854', 'n_tokens_mistral': 498, 'n_tokens_neox': 496, 'n_words': 95}