bible270 1.7.2 → 1.7.3
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/CHANGELOG.md +1 -0
- data/README.md +1 -2
- data/lib/bible270/reader_progress_report.rb +18 -8
- data/lib/bible270/version.rb +1 -1
- data/lib/tasks/bible270_readers.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fe74d08b4d06ebec2cb3d91955e43f0fc653ffc6bae931c54593153f915663e
|
|
4
|
+
data.tar.gz: cadca46de142316a8b80aa68ebc6c560e2da54697d990946fe0e2ffcaa14b83d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69369323563ab2c5117ef7c2a59fc6b4d66924ddefee34bc72e53e8769abd48dce6043d630fa446d95f201a861d7ded6d18402d2d4da51c222517e9e00579a72
|
|
7
|
+
data.tar.gz: 0a4c6d9b25fd2bc9f01a0290e661b7ccd6072408e2a9a83b7a1f9c417313a2427655cb6b3b9a406bc311459e40b8aa437b8442fe4bfa84b7b69e71d02b34215c
|
data/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,7 @@ All notable changes to bible270. Format follows [Keep a Changelog](https://keepa
|
|
|
12
12
|
### Changed
|
|
13
13
|
|
|
14
14
|
- link reader email addresses directly to email composition and link recent-activity day labels to their Day pages with passage tooltips in Admin
|
|
15
|
+
- include each reader's last reading-activity date in the `bible270:readers:list` and Admin Reader Stats reports
|
|
15
16
|
|
|
16
17
|
**[Full Changelog](https://github.com/avonderluft/bible270/compare/v1.6.2...main)**
|
|
17
18
|
|
data/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Bible 270
|
|
2
|
-
|
|
3
|
-
[](https://rubygems.org/gems/bible270) [](https://coveralls.io/github/avonderluft/bible270?branch=main) [](https://rubygems.org/gems/bible270) [](https://github.com/avonderluft/bible270/releases)
|
|
2
|
+
[](https://github.com/avonderluft/comfortable-media-surfer/actions/workflows/rubyonrails.yml) [](https://coveralls.io/github/avonderluft/bible270?branch=main) [](https://rubygems.org/gems/bible270) [](https://rubygems.org/gems/bible270) [](https://github.com/avonderluft/bible270/releases)
|
|
4
3
|
|
|
5
4
|
A mountable **Rails engine** that drops a 270-day (9 month) interactive Bible reading plan into any Rails app, built with [ComfortableMediaSurfer](https://github.com/shakacode/comfortable-media-surfer) CMS in mind. Readers tick off each day's readings, post reflections, and see how everyone else is getting on, much like the social plans on Bible.com.
|
|
6
5
|
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
module Bible270
|
|
4
4
|
# Builds the plain-text reader progress table used by administrative tasks.
|
|
5
5
|
class ReaderProgressReport
|
|
6
|
-
HEADERS = ['Name', 'Days Read', 'Status'].freeze
|
|
6
|
+
HEADERS = ['Name', 'Days Read', 'Status', 'Last Activity'].freeze
|
|
7
7
|
SORTS = %w[
|
|
8
8
|
first_name last_name most_completed least_completed most_recent_activity least_recent_activity
|
|
9
9
|
].freeze
|
|
10
10
|
DEFAULT_SORT = 'most_completed'
|
|
11
|
-
Row = Struct.new(:name, :days_read, :status, keyword_init: true)
|
|
11
|
+
Row = Struct.new(:name, :days_read, :status, :last_activity, keyword_init: true)
|
|
12
12
|
|
|
13
|
-
def initialize(readers: Reader.all, completed_days: Reader.completed_days_by_id, recent_activities:
|
|
13
|
+
def initialize(readers: Reader.all, completed_days: Reader.completed_days_by_id, recent_activities: nil,
|
|
14
14
|
sort: DEFAULT_SORT)
|
|
15
|
-
@readers = readers
|
|
15
|
+
@readers = readers.to_a
|
|
16
16
|
@completed_days = completed_days
|
|
17
|
-
@recent_activities = recent_activities
|
|
17
|
+
@recent_activities = recent_activities || Checkoff.recent_activity_by_reader(@readers.map(&:id))
|
|
18
18
|
@sort = SORTS.include?(sort.to_s) ? sort.to_s : DEFAULT_SORT
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -25,18 +25,23 @@ module Bible270
|
|
|
25
25
|
def rows
|
|
26
26
|
@rows ||= sorted_readers.map do |reader|
|
|
27
27
|
days_read = completed_days.fetch(reader.id, 0)
|
|
28
|
-
Row.new(
|
|
28
|
+
Row.new(
|
|
29
|
+
name: reader.display_name,
|
|
30
|
+
days_read: days_read,
|
|
31
|
+
status: status(reader, days_read),
|
|
32
|
+
last_activity: last_activity_date(reader)
|
|
33
|
+
)
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
def empty? = rows.empty?
|
|
33
38
|
|
|
34
39
|
def to_table
|
|
35
|
-
values = rows.map { |row| [row.name, row.days_read.to_s, row.status] }
|
|
40
|
+
values = rows.map { |row| [row.name, row.days_read.to_s, row.status, row.last_activity] }
|
|
36
41
|
widths = HEADERS.each_index.map do |index|
|
|
37
42
|
([HEADERS[index].length] + values.map { |value| value[index].length }).max
|
|
38
43
|
end
|
|
39
|
-
format = "%-#{widths[0]}s %#{widths[1]}s %-#{widths[2]}s"
|
|
44
|
+
format = "%-#{widths[0]}s %#{widths[1]}s %-#{widths[2]}s %-#{widths[3]}s"
|
|
40
45
|
lines = [format % HEADERS, format % widths.map { |width| '-' * width }].map(&:rstrip)
|
|
41
46
|
lines.concat(values.map { |value| (format % value).rstrip })
|
|
42
47
|
lines.join("\n")
|
|
@@ -70,6 +75,11 @@ module Bible270
|
|
|
70
75
|
[activity.nil? ? 1 : 0, descending && timestamp ? -timestamp : timestamp.to_f, reader.sort_name, reader.id]
|
|
71
76
|
end
|
|
72
77
|
|
|
78
|
+
def last_activity_date(reader)
|
|
79
|
+
occurred_at = recent_activities[reader.id]&.occurred_at
|
|
80
|
+
occurred_at ? Bible270.local_time(occurred_at).strftime('%b %-d, %Y') : '—'
|
|
81
|
+
end
|
|
82
|
+
|
|
73
83
|
def status(reader, days_read)
|
|
74
84
|
calendar_day = reader.calendar_day
|
|
75
85
|
return 'undated' unless calendar_day
|
data/lib/bible270/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ require 'bible270/reader_progress_report'
|
|
|
4
4
|
|
|
5
5
|
namespace :bible270 do
|
|
6
6
|
namespace :readers do
|
|
7
|
-
desc 'List readers by completed days with their schedule status'
|
|
7
|
+
desc 'List readers by completed days with their schedule status and last activity'
|
|
8
8
|
task list: :environment do
|
|
9
9
|
report = Bible270::ReaderProgressReport.new
|
|
10
10
|
if report.empty?
|