effective_datatables 2.1.13 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e90ec2c77193da9eb07f632193c5cf1714a8c121
         | 
| 4 | 
            +
              data.tar.gz: c52a0ff93cc7aa36593309bdeb301cdcc7ee675d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: eabd2993073736222a0396e30a702c8f4d3c8266f351315d1b72b74cb6cf445cc43a9c0eedf97f0c6c384de0d6ee35ac53dbe843fa5f1ee5246f2d99abc05c68
         | 
| 7 | 
            +
              data.tar.gz: 37376c4a58bdf27a70f6681621aad9b8bc7e9a74505efa2fc61f556690252c84efa57e442e13722797d26caae4833d54983435f3c76b4fa6f28e4ccfa62ca410
         | 
| @@ -25,9 +25,9 @@ module Effective | |
| 25 25 | 
             
                  if [:string, :text].include?(order_column[:type]) && order_column[:sql_as_column] != true
         | 
| 26 26 | 
             
                    collection.order("COALESCE(#{column}, '') #{order_direction}")
         | 
| 27 27 | 
             
                  elsif order_column[:type] == :belongs_to_polymorphic
         | 
| 28 | 
            -
                    collection.order("(#{column.sub('_id"', '_type"')}, #{column}) #{order_direction} | 
| 28 | 
            +
                    collection.order("(#{column.sub('_id"', '_type"')}, #{column}) #{order_direction}")
         | 
| 29 29 | 
             
                  else
         | 
| 30 | 
            -
                    collection.order("#{column} #{order_direction} | 
| 30 | 
            +
                    collection.order("COALESCE(#{column}, '') #{order_direction}")
         | 
| 31 31 | 
             
                  end
         | 
| 32 32 | 
             
                end
         | 
| 33 33 |  | 
| @@ -117,6 +117,8 @@ module Effective | |
| 117 117 | 
             
                    rescue => e
         | 
| 118 118 | 
             
                      collection
         | 
| 119 119 | 
             
                    end
         | 
| 120 | 
            +
                  when :boolean
         | 
| 121 | 
            +
                    collection.public_send(sql_op, "#{column} = :term", term: [1, 'true', 'yes'].include?(term.to_s.downcase))
         | 
| 120 122 | 
             
                  when :integer
         | 
| 121 123 | 
             
                    collection.public_send(sql_op, "#{column} = :term", term: term.gsub(/\D/, '').to_i)
         | 
| 122 124 | 
             
                  when :year
         | 
| @@ -89,9 +89,9 @@ module Effective | |
| 89 89 | 
             
                      # https://github.com/rails/rails/issues/15331
         | 
| 90 90 | 
             
                      if collection_class.connection.respond_to?(:unprepared_statement)
         | 
| 91 91 | 
             
                        collection_sql = collection_class.connection.unprepared_statement { collection.to_sql }
         | 
| 92 | 
            -
                        (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection_sql}) AS datatables_total_count").first | 
| 92 | 
            +
                        (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection_sql}) AS datatables_total_count").first.values.first rescue 1).to_i
         | 
| 93 93 | 
             
                      else
         | 
| 94 | 
            -
                        (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection.to_sql}) AS datatables_total_count").first | 
| 94 | 
            +
                        (collection_class.connection.execute("SELECT COUNT(*) FROM (#{collection.to_sql}) AS datatables_total_count").first.values.first rescue 1).to_i
         | 
| 95 95 | 
             
                      end
         | 
| 96 96 | 
             
                    else
         | 
| 97 97 | 
             
                      collection.size
         | 
| @@ -24,9 +24,9 @@ module Effective | |
| 24 24 | 
             
                        if collection_class.connection.respond_to?(:unprepared_statement)
         | 
| 25 25 | 
             
                          # https://github.com/rails/rails/issues/15331
         | 
| 26 26 | 
             
                          col_sql = collection_class.connection.unprepared_statement { col.to_sql }
         | 
| 27 | 
            -
                          self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col_sql}) AS datatables_filtered_count").first | 
| 27 | 
            +
                          self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col_sql}) AS datatables_filtered_count").first.values.first rescue 1).to_i
         | 
| 28 28 | 
             
                        else
         | 
| 29 | 
            -
                          self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_filtered_count").first | 
| 29 | 
            +
                          self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_filtered_count").first.values.first rescue 1).to_i
         | 
| 30 30 | 
             
                        end
         | 
| 31 31 | 
             
                      end
         | 
| 32 32 | 
             
                    end
         |