<commit_before>module QueryPerProject
  module Patches
    module QueriesHelperPatch
      def self.included(base) # :nodoc:
        base.send(:include, InstanceMethods)

        base.class_eval do
          unloadable # Send unloadable so it will not be unloaded in development

          alias_method_chain :retrieve_query, :default_query
        end

      end

      module ClassMethods
      end

      module InstanceMethods

        def retrieve_query_with_default_query
          # workaround bug in homepage plugin (if set to query_id, not possible to change custom at all)
          #if !@project && params[:set_filter] && params[:query_id]
          #  params.delete(:query_id)
          #end
          #
          
          if params[:query_id].blank? && (api_request? || params[:set_filter] || session[:query].nil? ||
             session[:query][:project_id] != (@project ? @project.id : nil) ||
             session[:query][:column_names].nil? )
         #   get_default_query
         
             cv=@project.custom_values.detect do |custom_value|
               true if custom_value.custom_field.name == "query_id" && !custom_value.value.blank?
             end
             #query_id = ( cv ? cv.value.to_s.strip : QPP_Constants::PROJECT_DEFAULT_SUFFIX )
             
             query_id = cv.value.to_s.strip unless cv.blank? 

            print "test #{query_id}"<commit_msg>fix bug page issue without project<commit_after>module QueryPerProject
  module Patches
    module QueriesHelperPatch
      def self.included(base) # :nodoc:
        base.send(:include, InstanceMethods)

        base.class_eval do
          unloadable # Send unloadable so it will not be unloaded in development

          alias_method_chain :retrieve_query, :default_query
        end

      end

      module ClassMethods
      end

      module InstanceMethods

        def retrieve_query_with_default_query
          # workaround bug in homepage plugin (if set to query_id, not possible to change custom at all)
          #if !@project && params[:set_filter] && params[:query_id]
          #  params.delete(:query_id)
          #end
          #
          
          if !@project.nil? && params[:query_id].blank? && (api_request? || params[:set_filter] || session[:query].nil? ||
             session[:query][:project_id] != (@project ? @project.id : nil) ||
             session[:query][:column_names].nil? )
         #   get_default_query
         
            cv=@project.custom_values.detect do |custom_value|
              true if custom_value.custom_field.name == "query_id" && !custom_value.value.blank?
            end
            #query_id = ( cv ? cv.value.to_s.strip : QPP_Constants::PROJECT_DEFAULT_SUFFIX )
             
            query_id = cv.value.to_s.strip unless cv.blank?
{'fraction_non_alphanumeric': 0.09545942080800858, 'fraction_numerical': 0.0, 'mean_word_length': 2.2123995407577497, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2205406', 'n_tokens_mistral': 795, 'n_tokens_neox': 778, 'n_words': 180}