effective_learndash 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 055abebf5e32951051e740bb37503fa91de36e71ba4d29b3dbf15d856b92d58f
4
- data.tar.gz: 368fca1c90d5cb2759e0877a13377ce7b29f247341921eda6dac4a1b4fb96535
3
+ metadata.gz: 4d25f8c1921377617abd4004f3adbb82d9e38589462c259a37e547ab2ec27798
4
+ data.tar.gz: 90e18a4a91c097e933bc8488a2f93df434c804f4f66ad8d5520f9861bf80053f
5
5
  SHA512:
6
- metadata.gz: 4c80d1913cc76209957f9f42cb36ae3db227322c87ddc3f0c65d3a0c81ac8246aeb96c5f0642493c879d6fbea9304845f634ecb392f169ffe7da497c16640930
7
- data.tar.gz: e1fc10afb44eedcdbd258c117f1aded4d59bdbf9387969aa8f3e206af61cca428fd65fe63776208d5c15609f3a8f9f167cf816f43ccaa1ba6a0f7adaf2a48777
6
+ metadata.gz: d2a6e4788833e47dba46b14a0055f54f7d183261e81f6e74672cd408406109f691a2b80f9f25f4576f05d9adc437ea3af50abd583d501b3092a429a52cad23da
7
+ data.tar.gz: e6fce4b599ff82a65b53859a95668462a97b7ba6509e81b00268d735802163c0cd271bc85fc9ae0c276425e1ab4a98ab07f3724cee4fe2f7162c42de4b648a1b
@@ -23,6 +23,19 @@ module EffectiveLearndashOwner
23
23
  # Not used
24
24
  has_many :learndash_enrollments, class_name: 'Effective::LearndashEnrollment', as: :owner, inverse_of: :owner, dependent: :delete_all
25
25
  accepts_nested_attributes_for :learndash_enrollments, allow_destroy: true
26
+
27
+ scope :with_completed_learndash_course, -> (course) {
28
+ courses = Array(course)
29
+ raise('expected a Learndash Course') unless courses.all? { |course| course.kind_of?(Effective::LearndashCourse) }
30
+
31
+ owners = Effective::LearndashEnrollment.completed
32
+ .where(learndash_course: courses)
33
+ .where(owner_type: name)
34
+ .select(:owner_id)
35
+
36
+ where(id: owners)
37
+ }
38
+
26
39
  end
27
40
 
28
41
  # Find
@@ -1,3 +1,3 @@
1
1
  module EffectiveLearndash
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_learndash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails