<commit_before>
class Stub < ActiveRecord::Base

include AadhiModelUtil

	def self.save_stubs(feature_name, flow_name, scenario_name)

		feature_model = Feature.find_or_initialize_by(:feature_name=>feature_name)
        feature_model.update(:feature_name=>feature_name)
        flows = feature_model.flows.find_or_initialize_by(:flow_name=>flow_name)
        flows.update(:flow_name=>flow_name)
        scenarios = flows.scenarios.find_or_initialize_by(:scenario_name=>scenario_name)
        scenarios.update(:scenario_name=>scenario_name) 
        @stubs = Stub.all.reverse
        @stubs.each do |route|
            routes = scenarios.routes.find_or_initialize_by(:path=>route.request_url)
            routes.update(:route_type=>route.route_type,:path=>sort_query_parameters(route.request_url),:request_body=>route.request_body,:fixture=>route.response,:status=>route.status,:host=>route.host)
          end    
          
	end

end
<commit_msg>Aadhi: Fixing encoding issue while storing URL with space or encoded characters<commit_after>
class Stub < ActiveRecord::Base

include AadhiModelUtil

	def self.save_stubs(feature_name, flow_name, scenario_name)

		feature_model = Feature.find_or_initialize_by(:feature_name=>feature_name)
        feature_model.update(:feature_name=>feature_name)
        flows = feature_model.flows.find_or_initialize_by(:flow_name=>flow_name)
        flows.update(:flow_name=>flow_name)
        scenarios = flows.scenarios.find_or_initialize_by(:scenario_name=>scenario_name)
        scenarios.update(:scenario_name=>scenario_name) 
        @stubs = Stub.all.reverse
        @stubs.each do |route|
            request_url = route.request_url
            final_url = URI.escape(URI.parse(request_url).path) 
            final_url = URI.decode(final_url+"?"+URI.parse(request_url).query)
            routes = scenarios.routes.find_or_initialize_by(:path=>sort_query_parameters(final_url))
            routes.update(:route_type=>route.route_type,:path=>sort_query_parameters(final_url),:request_body=>route.request_body,:fixture=>route.response,:status=>route.status,:host=>route.host)  
        end    
          
	end

end

{'fraction_non_alphanumeric': 0.10672853828306264, 'fraction_numerical': 0.0, 'mean_word_length': 4.297297297297297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '5663628', 'n_tokens_mistral': 678, 'n_tokens_neox': 685, 'n_words': 77}