effective_learndash 0.5.2 → 0.6.0
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 +4 -4
- data/app/datatables/admin/effective_learndash_enrollments_datatable.rb +1 -0
- data/app/datatables/effective_learndash_available_courses_datatable.rb +1 -3
- data/app/models/effective/learndash_enrollment.rb +26 -27
- data/app/views/admin/learndash_courses/_form.html.haml +3 -3
- data/app/views/admin/learndash_users/_learndash_user.html.haml +1 -1
- data/app/views/effective/learndash/_dashboard.html.haml +3 -2
- data/config/routes.rb +2 -2
- data/db/migrate/101_create_effective_learndash.rb +1 -0
- data/lib/effective_learndash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbd7d00a9c8c0dd7715549afd145caf8f920a442ab76b6653e5606f1911abe4b
|
4
|
+
data.tar.gz: 583bfa80479b118ef76b83bb3c55566fdfc4124a5d9390b20de20202f06606e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b50cdb0c0621f8096fd69ca90a0ca83319164949f9254219b04b7334f7238f4dffb8ccd914f559ff01dd7fb4d1cd6799c05a7b1b8441d78fbdd676fe32ee9c8
|
7
|
+
data.tar.gz: a57c4396de6504918637c50afd9591ce77636680b8e658a40feceac09da92c0ce9b5e45d97f28e6ddbc582b20ab763e83ffd9963c977313bc6703566ff99bcd2
|
@@ -9,9 +9,7 @@ class EffectiveLearndashAvailableCoursesDatatable < Effective::Datatable
|
|
9
9
|
end
|
10
10
|
|
11
11
|
actions_col show: false do |learndash_course|
|
12
|
-
if
|
13
|
-
'Registered. Please access from the home dashboard or applicant wizard.'
|
14
|
-
elsif learndash_course.can_register?
|
12
|
+
if learndash_course.can_register?
|
15
13
|
dropdown_link_to('Register', effective_learndash.new_learndash_course_course_registration_path(learndash_course))
|
16
14
|
end
|
17
15
|
end
|
@@ -8,12 +8,11 @@ module Effective
|
|
8
8
|
|
9
9
|
log_changes(to: :learndash_course, except: [:last_synced_at]) if respond_to?(:log_changes)
|
10
10
|
|
11
|
-
|
12
|
-
# Finished is treated as an admin override for completed?
|
13
|
-
PROGRESS_STATUSES = ['not-started', 'in-progress', 'completed', 'finished']
|
11
|
+
PROGRESS_STATUSES = ['not-started', 'in-progress', 'completed']
|
14
12
|
|
15
13
|
effective_resource do
|
16
14
|
last_synced_at :string
|
15
|
+
admin_completed :boolean
|
17
16
|
|
18
17
|
# Wordpress
|
19
18
|
progress_status :string
|
@@ -28,7 +27,7 @@ module Effective
|
|
28
27
|
timestamps
|
29
28
|
end
|
30
29
|
|
31
|
-
scope :completed, -> { where(progress_status:
|
30
|
+
scope :completed, -> { where(progress_status: 'completed').or(where(admin_completed: true)) }
|
32
31
|
scope :in_progress, -> { where(progress_status: 'in-progress') }
|
33
32
|
scope :not_started, -> { where(progress_status: 'not-started') }
|
34
33
|
|
@@ -63,35 +62,27 @@ module Effective
|
|
63
62
|
progress_status == 'in-progress'
|
64
63
|
end
|
65
64
|
|
66
|
-
# Admin override to completed
|
67
|
-
def finished?
|
68
|
-
progress_status == 'finished'
|
69
|
-
end
|
70
|
-
|
71
65
|
# Checked to see if the course is done throughout
|
72
66
|
def completed?
|
73
|
-
progress_status == 'completed' ||
|
67
|
+
progress_status == 'completed' || admin_completed?
|
74
68
|
end
|
75
69
|
|
76
70
|
def completed_on
|
77
|
-
date_completed
|
71
|
+
date_completed
|
78
72
|
end
|
79
73
|
|
80
|
-
|
81
|
-
|
82
|
-
|
74
|
+
# This is an admin action only
|
75
|
+
def mark_as_completed!
|
76
|
+
self.date_started ||= Time.zone.now
|
77
|
+
self.date_completed ||= Time.zone.now
|
83
78
|
|
84
|
-
|
85
|
-
|
86
|
-
if date_completed.present?
|
87
|
-
assign_attributes(progress_status: 'completed')
|
88
|
-
elsif date_started.present?
|
89
|
-
assign_attributes(progress_status: 'in-progress')
|
90
|
-
else
|
91
|
-
assign_attributes(progress_status: 'not-started')
|
92
|
-
end
|
79
|
+
update!(progress_status: 'completed', admin_completed: true)
|
80
|
+
end
|
93
81
|
|
94
|
-
|
82
|
+
# This is an admin action only
|
83
|
+
def uncomplete!
|
84
|
+
assign_attributes(date_started: nil, date_completed: nil, progress_status: nil, admin_completed: false)
|
85
|
+
refresh!
|
95
86
|
end
|
96
87
|
|
97
88
|
def refresh!(force: false)
|
@@ -113,11 +104,19 @@ module Effective
|
|
113
104
|
last_step: data[:last_step],
|
114
105
|
steps_completed: data[:steps_completed],
|
115
106
|
steps_total: data[:steps_total],
|
116
|
-
date_started: Time.use_zone('UTC') { Time.zone.parse(data[:date_started]) },
|
117
|
-
date_completed: (Time.use_zone('UTC') { Time.zone.parse(data[:date_completed]) } if data[:date_completed].present?)
|
118
107
|
)
|
119
108
|
|
120
|
-
|
109
|
+
if (date = data[:date_started]).present?
|
110
|
+
assign_attributes(date_started: Time.use_zone('UTC') { Time.zone.parse(date) })
|
111
|
+
end
|
112
|
+
|
113
|
+
if (date = data[:date_completed]).present?
|
114
|
+
assign_attributes(date_completed: Time.use_zone('UTC') { Time.zone.parse(date) })
|
115
|
+
end
|
116
|
+
|
117
|
+
unless completed?
|
118
|
+
assign_attributes(progress_status: data[:progress_status])
|
119
|
+
end
|
121
120
|
|
122
121
|
true
|
123
122
|
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
%p Click the New button from the below table to enroll a user into this course.
|
9
9
|
%p Enrolling a user here will enroll them on the LearnDash site.
|
10
10
|
%p Alternately, if this course is available for registration, the enrollment will be created upon registration purchase.
|
11
|
-
%p Marking the course
|
11
|
+
%p Marking the course completed here will allow them to proceed without completing the course on the Learndash LMS.
|
12
12
|
|
13
13
|
- datatable = Admin::EffectiveLearndashEnrollmentsDatatable.new(learndash_course: learndash_course)
|
14
14
|
= render_datatable(datatable, inline: true)
|
@@ -21,6 +21,6 @@
|
|
21
21
|
= tab 'Wizard' do
|
22
22
|
= render '/admin/learndash_courses/form_course_registration_content', learndash_course: learndash_course
|
23
23
|
|
24
|
-
- if learndash_course.respond_to?(:
|
24
|
+
- if learndash_course.respond_to?(:logs_datatable)
|
25
25
|
= tab "Logs" do
|
26
|
-
= render_inline_datatable(learndash_course.
|
26
|
+
= render_inline_datatable(learndash_course.log_s_datatable)
|
@@ -24,7 +24,7 @@
|
|
24
24
|
%p
|
25
25
|
Click the New button from the below table to manually enroll this user into a new course.
|
26
26
|
%br
|
27
|
-
%small.text-muted Marking the course
|
27
|
+
%small.text-muted Marking the course completed here will allow them to proceed without completing the course on the Learndash LMS.
|
28
28
|
|
29
29
|
- datatable = Admin::EffectiveLearndashEnrollmentsDatatable.new(learndash_user: learndash_user)
|
30
30
|
= render_datatable(datatable, inline: true)
|
@@ -33,5 +33,6 @@
|
|
33
33
|
- available = EffectiveResources.best('EffectiveLearndashAvailableCoursesDatatable').new(self)
|
34
34
|
|
35
35
|
- if available.present? && authorized_registration
|
36
|
-
|
37
|
-
|
36
|
+
.mt-4
|
37
|
+
%p The following courses are available for registration:
|
38
|
+
= render_datatable(available, simple: true)
|
data/config/routes.rb
CHANGED
@@ -23,8 +23,8 @@ EffectiveLearndash::Engine.routes.draw do
|
|
23
23
|
|
24
24
|
resources :learndash_enrollments, only: [:index, :new, :create, :update] do
|
25
25
|
post :refresh, on: :member
|
26
|
-
post :
|
27
|
-
post :
|
26
|
+
post :mark_as_completed, on: :member
|
27
|
+
post :uncomplete, on: :member
|
28
28
|
end
|
29
29
|
|
30
30
|
resources :learndash_courses, only: [:index, :edit, :update] do
|
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.
|
4
|
+
version: 0.6.0
|
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-10-
|
11
|
+
date: 2023-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|