bible270 1.21.0 → 1.22.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca2ca3981b6c3cd8da3fbaa6275e561c70420954ef6428b36bb025204e41bed4
4
- data.tar.gz: 6169febfe94b15f98fff318d8928a168bdb4dd3b61e92e15c786618f015e48f1
3
+ metadata.gz: fa125c1f5327e09b53600667b4a6b0bed5aad83fadc326e8dcc295a6f5216297
4
+ data.tar.gz: 1dad160748418eb129ec15cd8c834a47b048b2ba7380cbf3386219ca24fff59e
5
5
  SHA512:
6
- metadata.gz: 4024e27fa121d2482f7101aad7a76aadd857d04e47644fb540d3c597727cedef907d6b0714bfcd6901277f880b2f7dbbacfa5063f43e9ecc6743c86f3537d8eb
7
- data.tar.gz: b71c9200061c9fda20bb08389837af2cd91be75b35a4a7f8311db2df6907ecb8c43ca84697c495169a8b14ab62c192e91d8a89c07ad55f44117d4f104e9a657c
6
+ metadata.gz: e47e4eb19954b25bf9edb075ca1a5361e8a168931eb10cde5a882f25bdb5bb0d7499b70c48ef039c07286537558ef13998fe7a65bcaabb333ac13e5610e34bd9
7
+ data.tar.gz: 7273b96ee5d4bf743dfdab964a939613b3536aa4dbc792e7476a7290a4cdc12541ed7f6c6eebaf35734cfd7008d6572ff3f87aaa1cbfc1a67c674796efa1d94d
data/CHANGELOG.md CHANGED
@@ -6,16 +6,34 @@ Notable changes, following [Keep a Changelog](https://keepachangelog.com/en/1.1.
6
6
 
7
7
  ### Added
8
8
 
9
- - set Plus95 per run or in a reader’s Profile: reread the New Testament, Psalms, and Proverbs over 95 more days; reflections stay visible when disabled
10
- - show the effective plan length in the standard overview tagline
11
- - show completed runs in Admin Alumni and the 270- and 365-day milestones in Community
9
+ - print a black-and-white reading checklist sized to use two sheets
12
10
 
13
- **Upgrade:** Install migrations `20260101000030` and `20260101000031` for Plus95 controls.
11
+ ### Changed
12
+
13
+ - put today links beside reading actions and compact the partially read list
14
+
15
+ ### Fixed
16
+
17
+ - sync check-offs between 270- and 365-day plans without relinking when lengths change
18
+
19
+ ## [1.21.0] - 2026-11-22
20
+
21
+ ### Added
22
+
23
+ - add optional Plus95 per run or reader: reread the New Testament, Psalms, and Proverbs on days 271–365
24
+ - show completed runs in Admin Alumni and 270- and 365-day milestones in Community
25
+ - expand the bundled Scripture frame collection
26
+
27
+ ### Changed
28
+
29
+ - show plan length and readings on the overview; keep Plus95 reflections visible when disabled
14
30
 
15
31
  ### Fixed
16
32
 
17
33
  - keep Scripture frame tests independent of routine catalog edits
18
34
 
35
+ **Upgrade:** Install migrations `20260101000030` and `20260101000031` for Plus95 controls.
36
+
19
37
  ## [1.20.0] - 2026-11-18
20
38
 
21
39
  ### Added
@@ -948,7 +966,8 @@ This is the initial public release.
948
966
 
949
967
  - Email sign-in requires working Action Mailer delivery in the host application. Set `config.mailer_from`; delivery is inline by default, or set `email_sign_in_deliver_later` when a queue backend is available.
950
968
 
951
- [Unreleased]: https://github.com/avonderluft/bible270/compare/v1.20.0...main
969
+ [Unreleased]: https://github.com/avonderluft/bible270/compare/v1.21.0...main
970
+ [1.21.0]: https://github.com/avonderluft/bible270/compare/v1.20.0...v1.21.0
952
971
  [1.20.0]: https://github.com/avonderluft/bible270/compare/v1.19.0...v1.20.0
953
972
  [1.19.0]: https://github.com/avonderluft/bible270/compare/v1.18.1...v1.19.0
954
973
  [1.18.1]: https://github.com/avonderluft/bible270/compare/v1.18.0...v1.18.1
data/README.md CHANGED
@@ -24,6 +24,8 @@ The Old Testament and Revelation 22 finish on day 270 alongside Psalm 1. Daily r
24
24
 
25
25
  `Bible270::Plan` generates the schedule from `Bible270::Versification`, not the database. **Progress and reflections are public.**
26
26
 
27
+ Use **My Progress → Print checklist** for a compact black-and-white copy of your plan, with a box for each passage.
28
+
27
29
  Community lists readers alphabetically. Signed-in readers, including admins in non-admin view, see progress bars and completed-day counts. A line marks today on active schedules, except undated, future, or ended ones. Visitors see names and join dates; management links and ahead/behind labels are admin-only.
28
30
 
29
31
  ## Requirements
@@ -318,7 +320,7 @@ Admin templates include `bible270/shared/admin_confirmations`, even with custom
318
320
 
319
321
  ### Progress sync
320
322
 
321
- Admins can link a reader to existing, active accounts on other installations with the same email. Readers sign in only on the primary site. New check-offs sync automatically; **Sync existing progress** copies earlier completions. Both add only missing check-offs—never uncheck readings, change dates, or copy reflections. Linked readers must use the same schedule, including their effective +95 setting.
323
+ Admins can link a reader to existing, active accounts on other installations with the same email. Readers sign in only on the primary site. New check-offs sync automatically; **Sync existing progress** copies earlier completions. Both add only missing check-offs—never uncheck readings, change dates, or copy reflections. Linked readers can use different plan lengths. Extra check-offs received by a 270-day reader stay hidden until +95 is enabled. Upgrade all linked sites for mixed-length sync. If a link already paused over a length mismatch, relink it and use **Sync existing progress**.
322
324
 
323
325
  Install migration `20260101000028` on every participating installation. Site administrators configure trust in their host initializers; no destination credentials are entered in Admin.
324
326
 
@@ -21,8 +21,8 @@ module Bible270
21
21
  return unless candidate.is_a?(Hash) && candidate['remote'].is_a?(Hash)
22
22
 
23
23
  context = link_context(reader: reader, admin: admin, destination: candidate['destination'])
24
- return unless candidate['remote']['plan_fingerprint'] == context.delete('plan_fingerprint')
25
- return unless context.all? { |key, value| candidate[key] == value }
24
+ return unless ProgressSync.fingerprint_days(candidate['remote']['plan_fingerprint'])
25
+ return unless context.except('plan_fingerprint').all? { |key, value| candidate[key] == value }
26
26
  return unless normalized_email(candidate['remote']['email']) == context['email']
27
27
 
28
28
  candidate
@@ -24,8 +24,8 @@ module Bible270
24
24
  reader = readers.first
25
25
  membership = Participation.chosen.find_by(reader_id: reader.id)
26
26
  with_membership_lock(membership, reader.id) do |current|
27
- digest = Sync.fingerprint(days: current.plan_days)
28
- raise Sync::Conflict, 'Reading plans differ' unless @payload['plan_fingerprint'] == digest
27
+ digest = @payload['plan_fingerprint']
28
+ fingerprint_days!(digest)
29
29
 
30
30
  unless reader.reload.email.to_s.strip.downcase == email && matching_readers(email).map(&:id) == [reader.id]
31
31
  raise Sync::Conflict, 'No unique active reader matches that email'
@@ -46,9 +46,9 @@ module Bible270
46
46
  raise Sync::Conflict, 'Linked membership changed; explicitly relink'
47
47
  end
48
48
 
49
- days = current.plan_days
50
- validate_completion_plan!(days)
49
+ days = fingerprint_days!(@payload['plan_fingerprint'])
51
50
  readings = validated_readings!(days)
51
+ # Include stored +95 checkoffs even when the member's current schedule hides them.
52
52
  existing = current.checkoffs.pluck(:day, :track, :part).to_set
53
53
  missing = readings.reject { |triple| existing.include?(triple) }
54
54
  Sync.suppress do
@@ -73,10 +73,6 @@ module Bible270
73
73
  super
74
74
  rescue Sync::Unauthorized
75
75
  render json: { error: 'Progress sync authentication failed' }, status: :unauthorized
76
- rescue Sync::PlanLengthMismatch
77
- # A matching binding can work again after a destination toggle. Use the
78
- # client's existing bounded retry path rather than immediately retiring it.
79
- render json: { error: 'Destination plan length differs from the linked plan' }, status: :service_unavailable
80
76
  rescue Sync::Conflict, ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
81
77
  render json: { error: 'Reader, membership, plan, or completion batch is incompatible' }, status: :conflict
82
78
  rescue Sync::Unavailable, Sync::ConfigurationError
@@ -122,15 +118,8 @@ module Bible270
122
118
  value
123
119
  end
124
120
 
125
- def validate_completion_plan!(days)
126
- digest = @payload['plan_fingerprint']
127
- return if digest == Sync.fingerprint(days: days)
128
-
129
- if Sync.other_plan_fingerprint?(digest, days: days)
130
- raise Sync::PlanLengthMismatch, 'Destination plan length differs from the linked plan'
131
- end
132
-
133
- raise Sync::Conflict, 'Reading plans differ'
121
+ def fingerprint_days!(digest)
122
+ Sync.fingerprint_days(digest) || raise(Sync::Conflict, 'Reading plans differ')
134
123
  end
135
124
 
136
125
  def validated_readings!(days)
@@ -33,6 +33,19 @@ module Bible270
33
33
  @remaining_partial_days = [partial_days.size - @partial_day_tasks.size, 0].max
34
34
  end
35
35
 
36
+ def print_progress
37
+ response.headers['Cache-Control'] = 'private, no-store'
38
+ @reader = current_reader
39
+ unless @reader
40
+ return redirect_to sign_in_path(origin: print_progress_path), alert: 'Please sign in to print your reading checklist.'
41
+ end
42
+
43
+ @plan_days = @reader.plan_days
44
+ @plan_start = @reader.effective_start_date
45
+ @checked_parts = @reader.checkoffs.where(day: 1..@plan_days).pluck(:day, :track, :part).to_set
46
+ render layout: false, formats: [:html]
47
+ end
48
+
36
49
  def show
37
50
  @reader = Reader.find_by(id: params[:id])
38
51
  redirect_to(community_path, alert: 'Reader not found.') and return unless @reader
@@ -0,0 +1,27 @@
1
+ <% codes = Bible270::Versification::VERSES.keys.zip(Bible270::Translations::BIBLE_COM_BOOK_CODES).to_h.transform_values { |code| code.sub(/[A-Z]+/, &:capitalize) } %>
2
+ <ol class="compact-checklist" role="list" aria-labelledby="checklist-title">
3
+ <% readings.each do |day, tracks| %>
4
+ <li class="compact-day">
5
+ <span class="day-number"><span class="visually-hidden">Day </span><%= day %></span>
6
+ <div>
7
+ <% tracks.each do |track, parts| %>
8
+ <% previous_book = nil %>
9
+ <% parts.each_with_index do |reference, part| %>
10
+ <% book, _, numbers = reference.rpartition(" ") %>
11
+ <% if (code = codes[book]) && numbers.match?(/\A\d/)
12
+ short_reference = book == previous_book ? numbers : "#{code} #{numbers}"
13
+ previous_book = book
14
+ else
15
+ short_reference = reference
16
+ previous_book = nil
17
+ end %>
18
+ <% checked = checked_parts.include?([day, track, part]) %>
19
+ <span class="passage" role="img" aria-label="<%= reference %> — <%= checked ? "Read" : "Not yet read" %>">
20
+ <span class="box" aria-hidden="true"><%= "✓" if checked %></span><span class="short-reference"><%= short_reference %></span>
21
+ </span>
22
+ <% end %>
23
+ <% end %>
24
+ </div>
25
+ </li>
26
+ <% end %>
27
+ </ol>
@@ -8,8 +8,7 @@
8
8
  <li class="b270-task">
9
9
  <div class="b270-task-body">
10
10
  <strong><%= link_to "Day #{day}", day_path(day, anchor: "reading_#{day}_#{first_track}") %></strong>
11
- <span>
12
- Still to read:
11
+ <span>·
13
12
  <%= safe_join(task[:remaining].map { |part|
14
13
  link_to(part[:reference], day_path(day, anchor: "reading_#{day}_#{part[:track]}"))
15
14
  }, " · ") %>
@@ -1,7 +1,12 @@
1
1
  <% content_for :title, "Community — #{Bible270.config.app_name}" %>
2
2
  <p class="b270-eyebrow">Community</p>
3
- <h1>Reading together</h1>
4
- <p class="lede">Walking through the Word, sharing reflections and encouraging one another.<% if @today_day %> <%= link_to "Go to today (Day #{@today_day})", day_path(@today_day), class: "b270-todaylink" %><% end %></p>
3
+ <div class="b270-community-heading">
4
+ <h1>Reading together</h1>
5
+ <% if @today_day %>
6
+ <%= link_to "Go to today (Day #{@today_day})", day_path(@today_day), class: "b270-todaylink" %>
7
+ <% end %>
8
+ </div>
9
+ <p class="lede">Walking through the Word, sharing reflections and encouraging one another.</p>
5
10
 
6
11
  <% if @readers.any? %>
7
12
  <div class="b270-list">
@@ -0,0 +1,137 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="color-scheme" content="only light">
7
+ <title>Reading checklist — <%= Bible270.config.app_name %></title>
8
+ <style nonce="<%= content_security_policy_nonce %>">
9
+ body { margin: 1rem; color: #000; background: #fff; font: 1rem/1.35 system-ui, sans-serif; }
10
+ main { max-width: 65rem; margin: auto; }
11
+ h1 { font-size: 1.5em; margin: 0 0 .2em; }
12
+ h2 { font-size: 1.25em; margin: .7em 0 .2em; }
13
+ p { margin: 0 0 .6em; }
14
+ a { color: inherit; }
15
+ button { font: inherit; }
16
+ .checklist-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75em; margin-bottom: .6em; }
17
+ .checklist-heading h1, .checklist-heading p { margin: 0; }
18
+ .checklist-heading p { min-width: 0; text-align: right; overflow-wrap: anywhere; }
19
+ .print-controls { margin-bottom: 1em; }
20
+ .print-controls a { margin-right: .75em; }
21
+ .print-controls p { margin-top: .3em; }
22
+ table { width: 100%; border-collapse: collapse; }
23
+ th, td { border-bottom: .5pt solid #000; padding: .16em .4em; text-align: left; vertical-align: top; }
24
+ thead th { border-bottom-width: 1pt; }
25
+ .passage { display: inline-block; margin-right: .4em; vertical-align: top; }
26
+ .box {
27
+ box-sizing: border-box; display: inline-block; width: 1em; height: 1em; border: 1px solid;
28
+ vertical-align: -.12em; line-height: .9; text-align: center;
29
+ }
30
+ .visually-hidden {
31
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
32
+ overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
33
+ }
34
+
35
+ .compact-checklist, .print-only { display: none; }
36
+
37
+ @page { margin: 10mm; }
38
+ @media print {
39
+ body { margin: 0; font: 8pt/1.14 Arial, sans-serif; }
40
+ main { max-width: none; }
41
+ .print-controls, .screen-checklist { display: none; }
42
+ .print-only { display: inline; }
43
+ .compact-checklist {
44
+ display: block; margin: 0; padding: 0; list-style: none;
45
+ columns: 3; column-gap: 8pt;
46
+ }
47
+ .compact-day {
48
+ display: grid; grid-template-columns: 3ch minmax(0, 1fr); gap: 2.5pt;
49
+ break-inside: avoid; border-bottom: .25pt dotted;
50
+ }
51
+ .checklist-extended .compact-checklist { line-height: 1.21; }
52
+ .day-number { text-align: right; font-weight: bold; font-variant-numeric: tabular-nums; }
53
+ .compact-checklist .passage { max-width: 100%; margin-right: 0; }
54
+ .compact-checklist .box { width: .85em; height: .85em; margin-right: 1pt; vertical-align: -.08em; line-height: .75; }
55
+ /* Use more of the second sheet on the shorter plan without forcing page breaks. */
56
+ .checklist-base .compact-checklist { font-size: 8.5pt; line-height: 1.25; }
57
+ .checklist-base .compact-day { padding-block: .6pt; }
58
+ .checklist-base .compact-checklist .box { font-size: 8pt; } /* Keep the original box size. */
59
+ }
60
+ /* A4 portrait has more vertical room than Letter. */
61
+ @media print and (min-height: 270mm) and (max-aspect-ratio: 3/4) {
62
+ .checklist-extended .compact-checklist { line-height: 1.225; }
63
+ }
64
+ </style>
65
+ </head>
66
+ <body>
67
+ <main class="<%= @plan_days > Bible270::Plan::DAYS ? 'checklist-extended' : 'checklist-base' %>">
68
+ <div class="print-controls">
69
+ <%= link_to "Back to My Progress", progress_path %>
70
+ <button id="print-checklist" type="button" hidden>Print checklist</button>
71
+ <p>You can also print from your browser with Ctrl+P or ⌘+P.</p>
72
+ </div>
73
+ <header class="checklist-heading">
74
+ <h1 id="checklist-title">Reading checklist</h1>
75
+ <p><%= @plan_days %>-day plan for <%= @reader.display_name %><% if @plan_start %><span class="print-only"> · Day 1: <time datetime="<%= @plan_start.iso8601 %>"><%= @plan_start.strftime("%b %-d, %Y") %></time></span><% end %></p>
76
+ </header>
77
+
78
+ <% base_days = Bible270::Plan::DAYS %>
79
+ <% readings = (1..@plan_days).to_h do |day|
80
+ [day, Bible270::Plan::TRACKS.keys.to_h { |track| [track, Bible270::Plan.parts_for(day, track)] }]
81
+ end %>
82
+ <%= render "compact_checklist", readings: readings, checked_parts: @checked_parts %>
83
+
84
+ <% sections = [1..base_days] %>
85
+ <% sections << ((base_days + 1)..@plan_days) if @plan_days > base_days %>
86
+ <% sections.each do |days| %>
87
+ <% extension = days.begin > base_days %>
88
+ <% tracks = extension ? Bible270::Plan::TRACKS.except("ot") : Bible270::Plan::TRACKS %>
89
+ <% if extension %><h2 class="screen-checklist" id="extension-title">+95 readings</h2><% end %>
90
+ <table class="screen-checklist" aria-labelledby="<%= extension ? "extension-title" : "checklist-title" %>">
91
+ <thead>
92
+ <tr>
93
+ <th scope="col">Day</th>
94
+ <% if @plan_start %><th scope="col">Date</th><% end %>
95
+ <% tracks.each do |track, info| %>
96
+ <th scope="col" class="track-<%= track %>"><%= info.fetch(:label) %></th>
97
+ <% end %>
98
+ </tr>
99
+ </thead>
100
+ <tbody>
101
+ <% days.each do |day| %>
102
+ <tr id="day-<%= day %>">
103
+ <th scope="row"><%= day %></th>
104
+ <% if @plan_start %>
105
+ <% date = Bible270::Plan.date_for(day, @plan_start, days: @plan_days) %>
106
+ <td><time datetime="<%= date.iso8601 %>"><%= date.strftime("%b %-d, %Y") %></time></td>
107
+ <% end %>
108
+ <% tracks.each_key do |track| %>
109
+ <% parts = readings.fetch(day).fetch(track) %>
110
+ <td class="track-<%= track %>">
111
+ <% if parts.empty? %>
112
+ <span aria-hidden="true">—</span><span class="visually-hidden">No reading</span>
113
+ <% end %>
114
+ <% parts.each_with_index do |reference, part| %>
115
+ <% checked = @checked_parts.include?([day, track, part]) %>
116
+ <span class="passage">
117
+ <span class="box" aria-hidden="true"><%= "✓" if checked %></span>
118
+ <span class="reference"><%= reference %></span><span class="visually-hidden"> — <%= checked ? "Read" : "Not yet read" %></span>
119
+ </span>
120
+ <% end %>
121
+ </td>
122
+ <% end %>
123
+ </tr>
124
+ <% end %>
125
+ </tbody>
126
+ </table>
127
+ <% end %>
128
+ </main>
129
+ <script nonce="<%= content_security_policy_nonce %>">
130
+ (() => {
131
+ const button = document.getElementById('print-checklist');
132
+ button.addEventListener('click', () => window.print());
133
+ button.hidden = false;
134
+ })();
135
+ </script>
136
+ </body>
137
+ </html>
@@ -1,7 +1,12 @@
1
1
  <% content_for :title, "My Progress — #{Bible270.config.app_name}" %>
2
2
 
3
3
  <p class="b270-eyebrow">My Progress</p>
4
- <h1>Your reading journey</h1>
4
+ <div class="b270-progress-heading">
5
+ <h1>Your reading journey</h1>
6
+ <% if @reader %>
7
+ <%= link_to "Print checklist", print_progress_path, class: "b270-btn", data: { turbo: false } %>
8
+ <% end %>
9
+ </div>
5
10
 
6
11
  <%= render "bible270/shared/progress" %>
7
12
 
@@ -40,19 +40,17 @@
40
40
 
41
41
  <%= render "bible270/shared/track_bars", reader: panel_reader %>
42
42
 
43
- <% if panel_behind %>
44
- <div class="b270-progress-actions">
43
+ <div class="b270-progress-actions">
44
+ <% if panel_behind %>
45
45
  <%= link_to "Catch up from Day #{panel_start_day} →", day_path(panel_start_day), class: "b270-btn" %>
46
46
  <%= link_to "Read with the community — Day #{panel_today_day}", day_path(panel_today_day), class: "b270-todaylink" %>
47
- </div>
48
- <% else %>
49
- <div class="b270-progress-actions">
47
+ <% else %>
50
48
  <%= link_to "#{day_verb} reading — Day #{panel_start_day} →", day_path(panel_start_day), class: "b270-btn" %>
51
49
  <% if panel_today_day && panel_today_day != panel_start_day %>
52
50
  <%= link_to "Go to today (Day #{panel_today_day})", day_path(panel_today_day), class: "b270-todaylink" %>
53
51
  <% end %>
54
- </div>
55
- <% end %>
52
+ <% end %>
53
+ </div>
56
54
 
57
55
  <% else %>
58
56
  <p class="b270-signedout"><%= link_to "Sign in", sign_in_path %> to track your progress and join
@@ -324,6 +324,9 @@
324
324
  .b270-eyebrow{font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:var(--gold);font-weight:600;margin:0 0 10px}
325
325
  .b270 h1{font-family:"Spectral",serif;font-weight:600;font-size:clamp(22px,6vw,33px);line-height:1.03;letter-spacing:-.01em;margin:0 0 6px}
326
326
  .b270 h1 em{font-style:italic;color:var(--muted);font-weight:400}
327
+ .b270-progress-heading,.b270-community-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
328
+ .b270 .b270-progress-heading>h1,.b270 .b270-community-heading>h1{margin:0;min-width:0;overflow-wrap:anywhere}
329
+ .b270 .b270-progress-heading>.b270-btn{flex:none;margin:0;padding:6px 10px;font-size:12.5px;white-space:nowrap}
327
330
  .b270 .lede{color:var(--muted);max-width:77ch;margin:0 0 24px;font-size:15px}
328
331
 
329
332
  .b270-panel{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:20px 22px;box-shadow:var(--shadow);margin-bottom:24px}
@@ -331,16 +334,16 @@
331
334
  .b270-bignum .n{font-family:"Spectral",serif;font-size:38px;font-weight:600;line-height:1}
332
335
  .b270-bignum .of{color:var(--muted);font-size:15px}
333
336
  .b270-bignum .pct{margin-left:auto;color:var(--gold);font-weight:600;font-variant-numeric:tabular-nums}
334
- .b270-progress-actions{display:flex;flex-direction:column;align-items:flex-start;gap:7px;margin:16px 0 0}
335
- .b270-todaylink{margin-left:16px;font-size:12px;color:var(--muted);text-decoration:none}
336
- .b270-todaylink:hover{color:var(--gold);text-decoration:underline}
337
-
337
+ .b270-progress-actions{display:flex;align-items:center;gap:8px 12px;margin:12px 0 0}
338
+ .b270 .b270-progress-actions>.b270-btn{margin:0;min-width:0;overflow-wrap:anywhere}
339
+ .b270 .b270-todaylink{min-width:0;margin-left:auto;font-size:12.5px;color:var(--muted);text-align:right;text-decoration:none;overflow-wrap:anywhere}
340
+ .b270 .b270-todaylink:is(:hover,:focus-visible){color:var(--gold);text-decoration:underline}
338
341
 
339
342
  .b270-task-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
340
343
  .b270-task{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;border:1px solid var(--line-soft);border-radius:9px;background:var(--task-surface)}
341
- .b270-task-body{display:grid;gap:3px;min-width:0}
344
+ .b270-task-body{min-width:0;font-size:12px;line-height:1.4}
342
345
  .b270-task-body strong{font-size:14px}
343
- .b270-task-body span{color:var(--muted);font-size:12px;line-height:1.4}
346
+ .b270-task-body span{color:var(--muted)}
344
347
  .b270-task-body span a{color:var(--muted);text-decoration:underline;text-decoration-color:var(--line)}
345
348
  .b270-task-body span a:hover{color:var(--gold);text-decoration-color:var(--gold)}
346
349
  .b270 .b270-task-link{flex:none;color:var(--gold);font-size:12.5px;font-weight:600;text-decoration:none;white-space:nowrap}
data/config/routes.rb CHANGED
@@ -69,6 +69,7 @@ Bible270::Engine.routes.draw do # rubocop:disable Metrics/BlockLength
69
69
  get 'reflections', to: 'comments#index', as: :reflections
70
70
 
71
71
  get 'progress', to: 'readers#progress', as: :progress
72
+ get 'progress/print', to: 'readers#print_progress', as: :print_progress
72
73
 
73
74
  get 'community', to: 'readers#index', as: :community
74
75
  get 'mention-suggestions', to: 'readers#mention_suggestions', as: :mention_suggestions, defaults: { format: :json }
@@ -58,8 +58,14 @@ module Bible270
58
58
  raise Conflict, 'A completion batch must contain at most 5000 readings'
59
59
  end
60
60
 
61
+ # Retain the link's digest for base-only batches, including for older peers.
62
+ fingerprint = link.plan_fingerprint
63
+ if readings.any? { |triple| triple.is_a?(Array) && triple.first.is_a?(Integer) && triple.first > Plan::DAYS }
64
+ fingerprint = ProgressSync.fingerprint(days: Plan::EXTENDED_DAYS)
65
+ end
66
+
61
67
  result = post('complete', reader_id: link.remote_reader_id, participation_id: link.remote_participation_id,
62
- generation: link.remote_generation, plan_fingerprint: link.plan_fingerprint, readings: readings)
68
+ generation: link.remote_generation, plan_fingerprint: fingerprint, readings: readings)
63
69
  unless nonnegative_integer?(result['added']) && nonnegative_integer?(result['existing']) &&
64
70
  result['added'] + result['existing'] == readings.uniq.length
65
71
  raise Unavailable, 'Destination returned invalid completion counts'
@@ -12,7 +12,7 @@ module Bible270
12
12
  class ConfigurationError < Error; end
13
13
  class Unavailable < Error; end
14
14
  class Conflict < Error; end
15
- class PlanLengthMismatch < Error; end
15
+
16
16
  class Unauthorized < Error; end
17
17
 
18
18
  autoload :Client, 'bible270/progress_sync/client'
@@ -45,9 +45,12 @@ module Bible270
45
45
  Digest::SHA256.hexdigest(JSON.generate(['bible270:completion:day-one-based:part-zero-based:v1', schedule]))
46
46
  end
47
47
 
48
- def other_plan_fingerprint?(digest, days:)
49
- other_days = days == Plan::DAYS ? Plan::EXTENDED_DAYS : Plan::DAYS
50
- digest == fingerprint(days: other_days)
48
+ # A fingerprint describes the positions on the wire, not a reader's current length.
49
+ def fingerprint_days(digest)
50
+ return Plan::DAYS if digest == fingerprint(days: Plan::DAYS)
51
+ return Plan::EXTENDED_DAYS if digest == fingerprint(days: Plan::EXTENDED_DAYS)
52
+
53
+ nil
51
54
  end
52
55
 
53
56
  def current_plan_days
@@ -83,17 +86,13 @@ module Bible270
83
86
  triples = normalize_readings(readings, days: days)
84
87
  next if triples.empty?
85
88
 
86
- digest = fingerprint(days: days)
87
89
  links.order(:id).lock.each do |link|
88
- validate_link!(link, membership: membership, run: run, digest: digest)
90
+ validate_link!(link, membership: membership, run: run)
89
91
  unless membership.progress_sync_generation == participation.progress_sync_generation
90
92
  raise Conflict, 'Source membership changed; explicitly relink this reader'
91
93
  end
92
94
 
93
95
  captured << enqueue!(link, triples)
94
- rescue PlanLengthMismatch
95
- # A toggle does not change the binding. Copy can catch up once it matches again.
96
- next
97
96
  rescue ConfigurationError, Conflict, Unauthorized => e
98
97
  pause!(link, e.message)
99
98
  end
@@ -128,8 +127,8 @@ module Bible270
128
127
  result = nil
129
128
  with_source_lock(membership) do |current, run|
130
129
  validate_membership!(current, run: run)
131
- digest = fingerprint(days: current.plan_days)
132
- unless remote['plan_fingerprint'] == digest
130
+ digest = remote['plan_fingerprint']
131
+ unless fingerprint_days(digest)
133
132
  raise Conflict, 'Destination uses a different reading plan; look up the destination again'
134
133
  end
135
134
  raise ConfigurationError, 'Destination URL changed; look up the destination again' unless configured_destination!(destination) == destination_settings
@@ -137,12 +136,12 @@ module Bible270
137
136
  existing = ProgressSyncLink.active.where(participation_id: current.id, destination: destination).lock.first
138
137
  if existing
139
138
  begin
140
- validate_link!(existing, membership: current, run: run, digest: digest)
139
+ validate_link!(existing, membership: current, run: run)
141
140
  binding_changed = %i[remote_reader_id remote_participation_id remote_generation].any? do |attribute|
142
141
  existing.public_send(attribute) != attributes.fetch(attribute)
143
142
  end
144
143
  pause!(existing, 'Destination reader binding changed; explicitly replaced') if binding_changed
145
- rescue PlanLengthMismatch, ConfigurationError, Conflict, Unauthorized => e
144
+ rescue ConfigurationError, Conflict, Unauthorized => e
146
145
  pause!(existing, e.message)
147
146
  end
148
147
  end
@@ -316,7 +315,7 @@ module Bible270
316
315
  end
317
316
  private_class_method :validate_membership!
318
317
 
319
- def validate_link!(link, membership: nil, run: nil, digest: nil)
318
+ def validate_link!(link, membership: nil, run: nil)
320
319
  raise Conflict, 'Progress sync link is paused; explicitly relink' unless link.active?
321
320
 
322
321
  membership ||= Participation.find(link.participation_id)
@@ -330,14 +329,7 @@ module Bible270
330
329
  raise ConfigurationError, 'Destination URL changed; explicitly relink'
331
330
  end
332
331
 
333
- days = membership.plan_days
334
- unless link.plan_fingerprint == (digest || fingerprint(days: days))
335
- if other_plan_fingerprint?(link.plan_fingerprint, days: days)
336
- raise PlanLengthMismatch, 'Source plan length differs from the linked plan'
337
- end
338
-
339
- raise Conflict, 'Reading plan changed; explicitly relink'
340
- end
332
+ raise Conflict, 'Reading plan changed; explicitly relink' unless fingerprint_days(link.plan_fingerprint)
341
333
 
342
334
  true
343
335
  end
@@ -382,7 +374,8 @@ module Bible270
382
374
  with_source_lock(link.participation) do |membership, run|
383
375
  link.reload.lock!
384
376
  validate_link!(link, membership: membership, run: run)
385
- normalize_readings(delivery.readings, days: membership.plan_days)
377
+ # A length toggle does not undo check-offs already captured for delivery.
378
+ normalize_readings(delivery.readings, days: Plan::EXTENDED_DAYS)
386
379
  unless ProgressSyncDelivery.where(id: delivery.id, claim_token: delivery.claim_token, delivered_at: nil)
387
380
  .where('locked_until > ?', Time.current).exists?
388
381
  raise Unavailable, 'Delivery lease expired before sending'
@@ -416,10 +409,7 @@ module Bible270
416
409
  next unless current
417
410
 
418
411
  now = Time.current
419
- if error.is_a?(PlanLengthMismatch)
420
- # No HTTP attempt occurred. Keep this batch and its retry budget intact.
421
- current.update!(attempts: current.attempts - 1, claim_token: nil, locked_until: nil, next_attempt_at: now + 60)
422
- elsif error
412
+ if error
423
413
  message = error.message.to_s.truncate(1000)
424
414
  current.update!(last_error: message, claim_token: nil, locked_until: nil,
425
415
  next_attempt_at: now + [60 * (2**(current.attempts - 1)), 21_600].min)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bible270
4
- VERSION = '1.21.0'
4
+ VERSION = '1.22.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bible270
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft
@@ -215,8 +215,10 @@ files:
215
215
  - app/views/bible270/notice_mailer/new_reader.html.erb
216
216
  - app/views/bible270/notice_mailer/new_reader.text.erb
217
217
  - app/views/bible270/profiles/edit.html.erb
218
+ - app/views/bible270/readers/_compact_checklist.html.erb
218
219
  - app/views/bible270/readers/_next_steps.html.erb
219
220
  - app/views/bible270/readers/index.html.erb
221
+ - app/views/bible270/readers/print_progress.html.erb
220
222
  - app/views/bible270/readers/progress.html.erb
221
223
  - app/views/bible270/readers/show.html.erb
222
224
  - app/views/bible270/sessions/new.html.erb