effective_learndash 0.1.0 → 0.1.1

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: '0970ec691c0993f6c77e5131eba3da9ed11ef1c74a5cd00f0cdba5373cf1f5b4'
4
- data.tar.gz: dd0229161ba6030e9711202259063af16e506ec6d029647d43a112b4ac4f8150
3
+ metadata.gz: f10afce8560043990198e9b364944ce9ed5d50f4c97f0a070074fa58a2e56014
4
+ data.tar.gz: b4f516fcd3ceac21941a5db7e7bb8a43766608bba652998dd5f6677c74b3eccc
5
5
  SHA512:
6
- metadata.gz: a6ff74e9f0842c69d6f69886a8a7ef86b1196bbfd83e803afdd58e075c8ac99371a4b125d22b67e136268b4b5d4ac6718371b3ff6db936abddcb123ac3d8b28a
7
- data.tar.gz: e742085fcf413769c5936203091663b95d704a98d4b26b3778d77668f62d7ec79a53c52ffade1e9cf0d4cf56941ab83797d67a3efac1905ae30755f416958ff2
6
+ metadata.gz: 7b2d11bce9c397f42f95b823003530eedfe21feb80fa08a28d04c92272085906812b9dcf2685b798a171262ae1054661535394246e7374a7f5f3dcd941d4e939
7
+ data.tar.gz: 1eef5bd56979080599f509b17df4835370fc392d0eded403d39091b0d3974846e9462ed215df69835158d4c0e0d3dad7bc2bea9b9f8160ae34875179522268f9
@@ -0,0 +1,19 @@
1
+ # Dashboard LearndashUsers
2
+ class EffectiveLearndashEnrollmentsDatatable < Effective::Datatable
3
+ datatable do
4
+ col :learndash_course
5
+ col :progress_status
6
+
7
+ col :last_step, visible: false
8
+ col :steps_completed, visible: false
9
+ col :steps_total, visible: false
10
+
11
+ col :date_started, as: :date
12
+ col :date_completed, as: :date
13
+ end
14
+
15
+ collection do
16
+ Effective::LearndashEnrollment.deep.where(learndash_user: current_user.learndash_user)
17
+ end
18
+
19
+ end
@@ -44,6 +44,12 @@ module Effective
44
44
  owner&.to_s || username.presence || 'learndash user'
45
45
  end
46
46
 
47
+ def check_and_refresh!
48
+ return if last_synced_at.present? && (Time.zone.now - last_synced_at) < 10
49
+ return if learndash_enrollments.none? { |enrollment| !enrollment.completed? }
50
+ refresh!
51
+ end
52
+
47
53
  def refresh!
48
54
  assign_api_course_enrollments
49
55
  save!
@@ -0,0 +1,28 @@
1
+ - learndash_user = current_user.try(:learndash_user)
2
+
3
+ %h2 Learndash Courses
4
+
5
+ - if learndash_user.blank?
6
+ %p You do not have a Learndash account.
7
+
8
+ - if learndash_user.present?
9
+ - # This queries the API
10
+ - learndash_user.check_and_refresh!
11
+
12
+ %p
13
+ = succeed('.') do
14
+ You have an existing account on
15
+ = link_to('Learndash', EffectiveLearndash.learndash_url.chomp('/'), target: '_blank')
16
+
17
+ %ul
18
+ %li Email: #{learndash_user.email}
19
+ %li Username: #{learndash_user.username}
20
+ %li Password: #{learndash_user.password}
21
+
22
+ - if learndash_user&.learndash_enrollments.present?
23
+ %p You are enrolled in #{pluralize(learndash_user.learndash_enrollments.length, 'course')}.
24
+
25
+ - datatable = EffectiveResources.best('EffectiveLearndashEnrollmentsDatatable').new(self)
26
+ = render_datatable(datatable, simple: true)
27
+ - else
28
+ You are not enrolled in any Learndash courses.
@@ -1,3 +1,3 @@
1
1
  module EffectiveLearndash
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_learndash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
@@ -185,6 +185,7 @@ files:
185
185
  - app/datatables/admin/effective_learndash_courses_datatable.rb
186
186
  - app/datatables/admin/effective_learndash_enrollments_datatable.rb
187
187
  - app/datatables/admin/effective_learndash_users_datatable.rb
188
+ - app/datatables/effective_learndash_enrollments_datatable.rb
188
189
  - app/helpers/effective_learndash_helper.rb
189
190
  - app/models/concerns/effective_learndash_owner.rb
190
191
  - app/models/effective/learndash_api.rb
@@ -196,6 +197,7 @@ files:
196
197
  - app/views/admin/learndash_owners/_form.html.haml
197
198
  - app/views/admin/learndash_users/_form.html.haml
198
199
  - app/views/admin/learndash_users/_learndash_user.html.haml
200
+ - app/views/effective/learndash/_dashboard.html.haml
199
201
  - config/effective_learndash.rb
200
202
  - config/routes.rb
201
203
  - db/migrate/01_create_effective_learndash.rb.erb