<commit_before>module Spree
  module Wombat
    module Handler
      class SetInventoryHandler < Base

        def process
          return response("PRODUCT: #{@payload.to_s}")
          sku = @payload[:inventory][:sku]
          variant = Spree::Variant.find_by_sku(sku)
          return response("Product with SKU #{sku} was not found", 404) unless variant

          @payload[:inventory][:locations].each do |inventory_payload|
            stock_location_name   = inventory_payload.first
            inventory_at_location = inventory_payload.last

            stock_location = Spree::StockLocation.find_by_name(stock_location_name) || Spree::StockLocation.find_by_admin_name(stock_location_name)
            return response("Stock location with name #{stock_location_name} was not found", 500) unless stock_location

            stock_item = stock_location.stock_items.where(variant: variant).first<commit_msg>Remove Debugging<commit_after>module Spree
  module Wombat
    module Handler
      class SetInventoryHandler < Base

        def process
          sku = @payload[:inventory][:sku]
          variant = Spree::Variant.find_by_sku(sku)
          return response("Product with SKU #{sku} was not found", 404) unless variant

          @payload[:inventory][:locations].each do |inventory_payload|
            stock_location_name   = inventory_payload.first
            inventory_at_location = inventory_payload.last

            stock_location = Spree::StockLocation.find_by_name(stock_location_name) || Spree::StockLocation.find_by_admin_name(stock_location_name)
            return response("Stock location with name #{stock_location_name} was not found", 500) unless stock_location

            stock_item = stock_location.stock_items.where(variant: variant).first
{'fraction_non_alphanumeric': 0.08220720720720721, 'fraction_numerical': 0.006756756756756757, 'mean_word_length': 3.4203980099502487, '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': '4733375', 'n_tokens_mistral': 503, 'n_tokens_neox': 475, 'n_words': 105}