spree_core 4.0.1 → 4.0.2

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
  SHA256:
3
- metadata.gz: f198b47ce6ffacaa3ff99713c9b694071dd5e0201cc34600574e5381329416f8
4
- data.tar.gz: 245aedf59897d0fe6f034a49a9ec1be6d1a29456b9301638c7c3899cee43e5e2
3
+ metadata.gz: e79320700b634228f0412b07daf6a3bd7b8af06ec5cc1bfc4ffa13928ea041a5
4
+ data.tar.gz: aa559a7fd3888ba8be2b02e6d0210430a0535424fb9346133a561f0750b52076
5
5
  SHA512:
6
- metadata.gz: f823098a0a0ed66d01b8e0f66345a9196491e82baa0bc412816e85e23f9e4a4cc81295a10269e1ae8aed5f7497e1abe17760bb78cf2535005f127cb25abda35c
7
- data.tar.gz: 3501369e0121a73fb35010a366d3b201adedfc7a83fff486603a40fbeccf52a80d281c6bffb1bc04f379945b72782972c5d27a4de2d8777ae20d071a4cb30796
6
+ metadata.gz: 24c0e981d5a9b8e54868224300755b3247a0ac647feb2916f052f1171ac50235fa8bf478200fc6e5c8af226bbc4773f849c09c0402ab6757ebd9ce4c61e0e5ef
7
+ data.tar.gz: b634ef167616757b41b6e2197c18e6b142b24db859ccd62d01c7b578743cfd235b2d733fe8a95f678669eb8f9f774549fc4ce4abece81353f6f7801790659e2a
@@ -143,7 +143,7 @@ module Spree
143
143
  end
144
144
 
145
145
  def include_discontinued(products)
146
- discontinued ? products : products.not_discontinued
146
+ discontinued ? products : products.available
147
147
  end
148
148
  end
149
149
  end
@@ -44,6 +44,10 @@ module Spree
44
44
  name.present?
45
45
  end
46
46
 
47
+ def name_matcher
48
+ Spree::Taxon.arel_table[:name].matches("%#{name}%")
49
+ end
50
+
47
51
  def by_ids(taxons)
48
52
  return taxons unless ids?
49
53
 
@@ -71,7 +75,7 @@ module Spree
71
75
  def by_name(taxons)
72
76
  return taxons unless name?
73
77
 
74
- taxons.where(name: name)
78
+ taxons.where(name_matcher)
75
79
  end
76
80
  end
77
81
  end
@@ -29,6 +29,17 @@ module Spree
29
29
 
30
30
  self.whitelisted_ransackable_associations = %w[bill_address ship_address]
31
31
  self.whitelisted_ransackable_attributes = %w[id email]
32
+
33
+ def self.with_address(query, address = :ship_address)
34
+ left_outer_joins(address).
35
+ where("#{Spree::Address.table_name}.firstname like ?", "%#{query}%").
36
+ or(left_outer_joins(address).where("#{Spree::Address.table_name}.lastname like ?", "%#{query}%"))
37
+ end
38
+
39
+ def self.with_email_or_addresses_ids(query, addresses_ids = [])
40
+ where('email LIKE ?', "%#{query}%").
41
+ or(where(id: addresses_ids))
42
+ end
32
43
  end
33
44
 
34
45
  # has_spree_role? simply needs to return true or false whether a user has a role or not.
@@ -11,7 +11,7 @@ module Spree
11
11
  products = updated_at(scope)
12
12
  products = price(products)
13
13
 
14
- products
14
+ products.distinct
15
15
  end
16
16
 
17
17
  private
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '4.0.1'
3
+ '4.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-29 00:00:00.000000000 Z
11
+ date: 2019-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant