bible270 1.18.1 → 1.19.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: e05722a707b9ded33b258dbc2636df5f1bbf93b782649f84ff8fc6efa7b2d6a3
4
- data.tar.gz: f53179ed25244dd464fe5815426543e0f32efa9ab7835713c4d99d382b17f03f
3
+ metadata.gz: 3dfc37decf954d5e4c09a801dd5351bb92bf581f76488d2313713ecfdb19ae20
4
+ data.tar.gz: 978863928b51813457d448ef3fb8c7744416a85917b53bdce0981309a4eabf5a
5
5
  SHA512:
6
- metadata.gz: e8aab969ee632687d27b77e410448b1c41ad97b22ea79d2412e545f98d2fff39b70d01747317c15c11c0a19596ef9ba4d10edc2004841a77a2ebfc43999e1bd2
7
- data.tar.gz: 83cf6dd7f75f5d0ac3bc22260f0db6166081e3321544f80f53f00bf01ee9101782ad8ad83fc96e9cbc2f31928e749f25c0f392ff58484a4b2b04acffda5e665f
6
+ metadata.gz: 7060fdc5566ff5bafd10f879fa99b9d353beace15e657ab6dc9c484496aa80d14caac3b6a094694393e2fb39c360a28bfa955635c6d1e7010be5dc4e96b16a05
7
+ data.tar.gz: b9cc997a2d380e110eaf34b2f5c74c454834c2488fc4585ce7cbf0e02a168a336808f7e34852b525073639d668afb15f6ac6dbe92188497e8ac4f29b1774868d
data/CHANGELOG.md CHANGED
@@ -4,12 +4,20 @@ Notable changes, following [Keep a Changelog](https://keepachangelog.com/en/1.1.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
- ### Added
7
+ ### Changed
8
8
 
9
- - let admins link matching reader accounts for one-way progress sync, including existing completions
10
- - queue reliable delivery between trusted instances, with retries and optional immediate background jobs
9
+ - give longer completion passages more reading time, from 5.5 to 30 seconds
10
+ - rotate Scripture frames in shuffled rounds shared by the bread popup and day completion
11
+ - speed up tests with balanced files, leaner fixtures, and CPU-aware image processing
12
+ - reuse unchanged reading-plan cache settings while preserving live configuration updates
11
13
 
12
- **Setup:** Install migration `20260101000028` on each instance, configure trusted connections, and schedule delivery on the primary. Progress sync is off until configured.
14
+ **Upgrade:** Install migration `20260101000029` to save readers' rotation across visits and devices.
15
+
16
+ ## [1.18.1] - 2026-11-14
17
+
18
+ ### Added
19
+
20
+ - expand the bundled Scripture frame collection
13
21
 
14
22
  ### Changed
15
23
 
@@ -18,6 +26,20 @@ Notable changes, following [Keep a Changelog](https://keepachangelog.com/en/1.1.
18
26
  ### Fixed
19
27
 
20
28
  - display the last sync time in the system time zone instead of UTC
29
+ - guard sync-secret configuration in setup examples so Docker builds need no runtime secrets
30
+
31
+ ## [1.18.0] - 2026-11-14
32
+
33
+ ### Added
34
+
35
+ - let admins link matching reader accounts for one-way progress sync, including existing completions
36
+ - queue reliable delivery between trusted instances, with retries and optional immediate background jobs
37
+
38
+ **Setup:** Install migration `20260101000028` on each instance, configure trusted connections, and schedule delivery on the primary. Progress sync is off until configured.
39
+
40
+ ### Fixed
41
+
42
+ - make the sync job test adapter compatible with Rails 7.2
21
43
 
22
44
  ## [1.17.2] - 2026-11-13
23
45
 
@@ -901,7 +923,9 @@ This is the initial public release.
901
923
 
902
924
  - 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.
903
925
 
904
- [Unreleased]: https://github.com/avonderluft/bible270/compare/v1.17.2...main
926
+ [Unreleased]: https://github.com/avonderluft/bible270/compare/v1.18.1...main
927
+ [1.18.1]: https://github.com/avonderluft/bible270/compare/v1.18.0...v1.18.1
928
+ [1.18.0]: https://github.com/avonderluft/bible270/compare/v1.17.2...v1.18.0
905
929
  [1.17.2]: https://github.com/avonderluft/bible270/compare/v1.17.1...v1.17.2
906
930
  [1.17.1]: https://github.com/avonderluft/bible270/compare/v1.17.0...v1.17.1
907
931
  [1.17.0]: https://github.com/avonderluft/bible270/compare/v1.16.0...v1.17.0
data/README.md CHANGED
@@ -414,7 +414,9 @@ For a host Content Security Policy (CSP), add `https://www.youtube-nocookie.com`
414
414
 
415
415
  Hover over the bread icon for **3 seconds**, or open it immediately by tap, click, or Enter/Space. The random, theme-matched frame closes when you leave a hover preview, press Escape, click outside, or select the bread again.
416
416
 
417
- Completing a day shows a random frame followed by the optional dove; both fade out together. Disabling the dove keeps the frame. Reduced-motion users see a static frame, and Escape dismisses the sequence.
417
+ Completion frames stay fully visible for **5.5–30 seconds**, based on passage length, before the optional dove and shared fade. Disabling the dove keeps the frame. Reduced-motion users see a static frame, and Escape dismisses the sequence.
418
+
419
+ The popup and completion frames share a shuffled rotation: each enabled text is selected before repeating, without back-to-back repeats when alternatives exist. Changing the available texts starts a fresh round. Migration `20260101000029` saves signed-in readers' rotation across visits and devices; visitors and installations awaiting migration use browser-session rotation.
418
420
 
419
421
  The [bundled YAML catalog](config/scripture_frames.yml) supplies the defaults in biblical order. Manage texts under **Admin → Scripture frames**:
420
422
 
@@ -763,9 +765,9 @@ node --test test/javascript/*.cjs
763
765
  bundle exec rubocop --cache false
764
766
  ```
765
767
 
766
- `rake test` uses up to eight CPU-aware workers and writes coverage to `coverage/index.html`. Tests share setup in `test/support`.
768
+ `rake test` uses up to 16 CPU-aware workers and writes coverage to `coverage/index.html`. Tests share setup in `test/support`; libvips uses one thread per worker to avoid CPU contention.
767
769
 
768
- Use `PARALLEL_WORKERS=4 bundle exec rake test` to choose the count, or `bundle exec rake test:serial` for serial coverage. Logs keep warnings and errors in `test/dummy/log/test-*.log`; set `TEST_LOG_LEVEL=debug` for request, template, and SQL details.
770
+ Use `PARALLEL_WORKERS=4 bundle exec rake test` to limit CPU/memory use, or `bundle exec rake test:serial` for serial coverage. `VIPS_CONCURRENCY` overrides image-processing threads. Logs keep warnings and errors in `test/dummy/log/test-*.log`; `TEST_LOG_LEVEL=debug` adds request/SQL details and `TEST_ERROR_PAGES=1` enables developer error pages. Unexpected errors still raise.
769
771
 
770
772
  JavaScript tests require **Node.js 22+**. Chromium layout checks run when a browser is available (`CHROME_BIN` selects it). Video tests do not contact YouTube; check live playback and host CSP separately.
771
773
 
data/Rakefile CHANGED
@@ -161,13 +161,15 @@ namespace :test do
161
161
  Rake::Task['test:serial'].enhance(['test:prepare_serial'])
162
162
 
163
163
  task :parallel do
164
- workers = ENV.fetch('PARALLEL_WORKERS') { Etc.nprocessors.clamp(1, 8).to_s }
164
+ workers = ENV.fetch('PARALLEL_WORKERS') { Etc.nprocessors.clamp(1, 16).to_s }
165
165
  FileUtils.rm_rf('coverage')
166
166
  env = {
167
167
  'PARALLEL_COVERAGE' => 'true',
168
168
  'RECORD_RUNTIME' => 'true',
169
169
  'SKIP_COV' => nil,
170
170
  'NO_COLOR' => '1',
171
+ # Parallel processes already use the CPUs; avoid nested libvips thread pools.
172
+ 'VIPS_CONCURRENCY' => ENV.fetch('VIPS_CONCURRENCY', '1'),
171
173
  'TMPDIR' => ENV.fetch('BIBLE270_TEST_TMPDIR', '/tmp')
172
174
  }
173
175
  command = ['bundle', 'exec', 'parallel_test', 'test', '--type', 'test', '-n', workers]
@@ -7,7 +7,7 @@ module Bible270
7
7
  return head :not_acceptable unless request.format.json?
8
8
 
9
9
  exclude = params[:exclude] if params[:exclude].is_a?(String)
10
- frame = ScriptureFrames.random(exclude: exclude)
10
+ frame = ScriptureFrames.random(exclude: exclude, reader: current_reader, session: session)
11
11
  return head :no_content unless frame
12
12
 
13
13
  render json: frame.to_h
@@ -1,5 +1,5 @@
1
1
  <%# locals: (day:, reader:, completion_event_id:) %>
2
- <% frame = Bible270::ScriptureFrames.random %>
2
+ <% frame = Bible270::ScriptureFrames.random(reader: reader, session: session) %>
3
3
  <div class="b270-completion" data-b270-completion data-b270-day="<%= day %>"
4
4
  data-b270-completion-event="<%= completion_event_id %>" data-turbo-temporary hidden>
5
5
  <% if frame %>
@@ -72,6 +72,12 @@
72
72
  if (current(state) && !state.finishing) dispose(state);
73
73
  }
74
74
 
75
+ function holdDuration(state) {
76
+ const text = state.frame.querySelector("[data-b270-scripture-text]")?.textContent || "";
77
+ const wordCount = text.match(/[^\s\p{White_Space}]+/gu)?.length || 0;
78
+ return Math.min(30000, Math.max(5500, 2000 + wordCount * 250));
79
+ }
80
+
75
81
  function fly(state) {
76
82
  if (!current(state)) return;
77
83
  if (!state.dove || motion?.matches) {
@@ -109,7 +115,7 @@
109
115
  state.raf = null;
110
116
  if (!current(state)) return;
111
117
  element.classList.add("is-visible");
112
- if (state.frame) later(state, () => fly(state), fadeInDuration() + 5500);
118
+ if (state.frame) later(state, () => fly(state), fadeInDuration() + holdDuration(state));
113
119
  else fly(state);
114
120
  });
115
121
  }
@@ -13,6 +13,16 @@
13
13
  translation: ESV
14
14
  text: But the word is very near you. It is in your mouth and in your heart, so that you can do it.
15
15
  attribution: ESV © 2001 Crossway.
16
+ - id: psalm-1-1-2
17
+ reference: Psalm 1:1-2
18
+ translation: NASB95
19
+ text: |-
20
+ How blessed is the man who does not walk in the counsel of the wicked,
21
+ Nor stand in the path of sinners,
22
+ Nor sit in the seat of scoffers!
23
+ But his delight is in the law of the LORD,
24
+ And in His law he meditates day and night.
25
+ attribution: NASB 1995 © The Lockman Foundation.
16
26
  - id: psalm-19-8
17
27
  reference: Psalm 19:8
18
28
  translation: NKJV
@@ -69,6 +79,13 @@
69
79
  The unfolding of Your words gives light;
70
80
  It gives understanding to the simple.
71
81
  attribution: NASB 1995 © The Lockman Foundation.
82
+ - id: psalm-119-162
83
+ reference: Psalm 119:162
84
+ translation: NASB95
85
+ text: |-
86
+ I rejoice at Your word,
87
+ As one who finds great spoil.
88
+ attribution: NASB 1995 © The Lockman Foundation.
72
89
  - id: proverbs-6-23
73
90
  reference: Proverbs 6:23
74
91
  translation: NASB95
@@ -83,6 +100,16 @@
83
100
  He who gives attention to the word will find good,
84
101
  And blessed is he who trusts in the LORD.
85
102
  attribution: NASB 1995 © The Lockman Foundation.
103
+ - id: isaiah-40-7-8
104
+ reference: Isaiah 40:7-8
105
+ translation: NASB95
106
+ text: |-
107
+ The grass withers, the flower fades,
108
+ When the breath of the LORD blows upon it;
109
+ Surely the people are grass.
110
+ The grass withers, the flower fades,
111
+ But the word of our God stands forever.
112
+ attribution: NASB 1995 © The Lockman Foundation.
86
113
  - id: isaiah-55-11
87
114
  reference: Isaiah 55:11
88
115
  translation: ESV
@@ -118,6 +145,11 @@
118
145
  “Is not My word like a fire?” says the LORD,
119
146
  “And like a hammer that breaks the rock in pieces?
120
147
  attribution: NKJV © 1982 Thomas Nelson.
148
+ - id: matthew-24-35
149
+ reference: Matthew 24:35
150
+ translation: NKJV
151
+ text: Heaven and earth will pass away, but My words will by no means pass away.
152
+ attribution: NKJV © 1982 Thomas Nelson.
121
153
  - id: john-6-63
122
154
  reference: John 6:63
123
155
  translation: NKJV
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddScriptureFrameRotationToBible270Readers < ActiveRecord::Migration[7.0]
4
+ def change
5
+ add_column :bible270_readers, :scripture_frame_rotation, :json, null: false, default: {}
6
+ end
7
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
4
+
3
5
  module Bible270
4
6
  # Repairs schema_migrations after a database is copied without matching migration
5
7
  # bookkeeping. A migration is safe to mark only when every table, column and
@@ -38,6 +40,7 @@ module Bible270
38
40
  'AddRevertToBible270PlanRuns' => :check_run_revert,
39
41
  'CreateBible270ScriptureFrames' => :check_scripture_frames,
40
42
  'CreateBible270ProgressSync' => :check_progress_sync,
43
+ 'AddScriptureFrameRotationToBible270Readers' => :check_scripture_frame_rotation,
41
44
 
42
45
  'CreateActiveStorageTables' => :check_active_storage
43
46
  }.freeze
@@ -307,6 +310,12 @@ module Bible270
307
310
  progress_sync_relationships_missing + progress_sync_link_indexes_missing
308
311
  end
309
312
 
313
+ def check_scripture_frame_rotation
314
+ table_missing(:bible270_readers, columns: %i[scripture_frame_rotation]) +
315
+ missing_column_definitions(:bible270_readers,
316
+ scripture_frame_rotation: { type: :json, null: false, default: {} })
317
+ end
318
+
310
319
  def check_admin
311
320
  table_missing(:bible270_readers, columns: %i[admin]) +
312
321
  missing_column_definitions(:bible270_readers, admin: { type: :boolean, null: false, default: false })
@@ -489,6 +498,13 @@ module Bible270
489
498
  connection.columns(table).flat_map do |column|
490
499
  definitions.fetch(column.name.to_sym, {}).filter_map do |attribute, expected|
491
500
  actual = column.public_send(attribute)
501
+ if attribute == :default && column.type == :json && actual.is_a?(String)
502
+ begin
503
+ actual = JSON.parse(actual)
504
+ rescue JSON::ParserError
505
+ # Leave malformed defaults unmatched.
506
+ end
507
+ end
492
508
  actual = ActiveModel::Type::Boolean.new.cast(actual) if attribute == :default && column.type == :boolean
493
509
  if attribute == :default && column.type == :integer && actual.is_a?(String) && actual.match?(%r{\A[+-]?\d+\z})
494
510
  actual = Integer(actual, 10)
data/lib/bible270/plan.rb CHANGED
@@ -187,7 +187,7 @@ module Bible270
187
187
  # Validated on the way out so a typo fails loudly instead of silently
188
188
  # producing overlapping or out-of-range readings.
189
189
  def chapter_breaks_for(book, chapter)
190
- points = configured_breaks[[book, chapter]]
190
+ points = cached_configured_breaks[[book, chapter]]
191
191
  return nil if points.nil?
192
192
 
193
193
  total = verses_for(book, chapter)
@@ -197,13 +197,13 @@ module Bible270
197
197
  "verse numbers between 1 and #{total - 1}, got #{points.inspect}"
198
198
  end
199
199
 
200
- points
200
+ points.dup
201
201
  end
202
202
 
203
203
  # {index => reading count} for chapters whose breaks are set explicitly.
204
204
  def pinned_from_breaks(chapters)
205
205
  chapters.each_with_index.filter_map do |(book, chapter), idx|
206
- points = configured_breaks[[book, chapter]]
206
+ points = cached_configured_breaks[[book, chapter]]
207
207
  [idx, points.size + 1] if points
208
208
  end.to_h
209
209
  end
@@ -233,7 +233,7 @@ module Bible270
233
233
  # all at once rather than leaving a half-rebuilt plan.
234
234
 
235
235
  def memo(key)
236
- fingerprint = configured_breaks
236
+ fingerprint = cached_configured_breaks
237
237
  if @cache_fingerprint != fingerprint
238
238
  @cache = {}
239
239
  @cache_fingerprint = fingerprint
@@ -247,6 +247,10 @@ module Bible270
247
247
  def reset!
248
248
  @cache = {}
249
249
  @cache_fingerprint = nil
250
+ @break_source_fingerprint = nil
251
+ @configured_breaks = nil
252
+ @file_breaks_stamp = nil
253
+ @file_breaks = nil
250
254
  true
251
255
  end
252
256
 
@@ -257,11 +261,26 @@ module Bible270
257
261
  # Bible270.config.chapter_breaks_path. The file is re-read whenever it
258
262
  # changes, so break points can be tuned without restarting the server.
259
263
 
264
+ # Keep the public result mutable without exposing the internal cache.
260
265
  def configured_breaks
261
- base = CHAPTER_BREAKS.merge(config_breaks)
266
+ cached_configured_breaks.to_h { |(book, chapter), points| [[book.dup, chapter], points.dup] }
267
+ end
268
+
269
+ def cached_configured_breaks
270
+ # Normalization snapshots mutable override arrays on every lookup.
271
+ overrides = config_breaks
262
272
  path = breaks_file_path
263
- path ? base.merge(file_breaks(path)) : base
273
+ from_file = file_breaks(path) if path
274
+ fingerprint = [CHAPTER_BREAKS, overrides, path && @file_breaks_stamp, from_file]
275
+ return @configured_breaks if @break_source_fingerprint == fingerprint
276
+
277
+ merged = CHAPTER_BREAKS.merge(overrides)
278
+ merged.merge!(from_file) if from_file
279
+ @configured_breaks = merged.freeze
280
+ @break_source_fingerprint = fingerprint
281
+ @configured_breaks
264
282
  end
283
+ private_class_method :cached_configured_breaks
265
284
 
266
285
  def config_breaks
267
286
  return {} unless bible270_config.respond_to?(:chapter_breaks)
@@ -284,11 +303,12 @@ module Bible270
284
303
  # not re-parsed on every request.
285
304
  def file_breaks(path)
286
305
  stat = File.stat(path)
287
- stamp = [path, stat.mtime.to_f, stat.size]
306
+ stamp = [path.dup, stat.mtime.to_f, stat.size]
288
307
  return @file_breaks if @file_breaks_stamp == stamp
289
308
 
309
+ parsed = parse_breaks_file(path)
290
310
  @file_breaks_stamp = stamp
291
- @file_breaks = parse_breaks_file(path)
311
+ @file_breaks = parsed
292
312
  end
293
313
 
294
314
  def parse_breaks_file(path)
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'digest'
4
+ require 'json'
5
+ require 'securerandom'
6
+
7
+ module Bible270
8
+ class ScriptureFrameRotation
9
+ SESSION_KEY = 'bible270_scripture_frame_rotation'
10
+ COLUMN = 'scripture_frame_rotation'
11
+ HEX_DIGEST = %r{\A[0-9a-f]{64}\z}
12
+ SEED = %r{\A[0-9a-f]{16}\z}
13
+ private_constant :COLUMN, :HEX_DIGEST, :SEED
14
+
15
+ def self.select(pool, reader: nil, session: nil, exclude: nil)
16
+ rotation = new(pool, exclude: exclude)
17
+ if reader&.persisted? && Reader.column_names.include?(COLUMN)
18
+ # Never lock the request's reader: it may carry unsaved profile changes.
19
+ locked = Reader.find(reader.id)
20
+ locked.with_lock do
21
+ frame, state = rotation.advance(locked[COLUMN])
22
+ locked.update_column(COLUMN, state) unless locked[COLUMN] == state
23
+ frame
24
+ end
25
+ else
26
+ rotation.select_from_session(session, reader)
27
+ end
28
+ end
29
+
30
+ def initialize(pool, exclude: nil)
31
+ @pool = pool.sort_by(&:id)
32
+ @catalog = Digest::SHA256.hexdigest(JSON.generate(@pool.map(&:id)))
33
+ @exclude = exclude if exclude.is_a?(String)
34
+ end
35
+
36
+ def select_from_session(session, reader)
37
+ return @pool.reject { |frame| @pool.length > 1 && frame.id == @exclude }.sample unless session
38
+
39
+ identity = reader&.id ? "reader:#{reader.id}" : 'visitor'
40
+ entry = session[SESSION_KEY]
41
+ previous = entry['state'] if entry.is_a?(Hash) && entry['identity'] == identity
42
+ frame, state = advance(previous)
43
+ session[SESSION_KEY] = { 'identity' => identity, 'state' => state }
44
+ frame
45
+ end
46
+
47
+ def advance(previous)
48
+ return [nil, {}] if @pool.empty? && !last_digest(previous)
49
+
50
+ state = valid_state?(previous) ? previous.dup : fresh_state(last_digest(previous))
51
+ state['deferred'] = state['deferred'].dup
52
+ return [nil, state] if @pool.empty?
53
+
54
+ state = fresh_state(state['last']) if state['cursor'] == @pool.length && state['deferred'].empty?
55
+ order = @pool.shuffle(random: Random.new(state['seed'].to_i(16)))
56
+ position = next_position(order, state)
57
+ frame = order[position]
58
+ state['deferred'].delete(position)
59
+ state['last'] = Digest::SHA256.hexdigest(frame.id)
60
+ [frame, state]
61
+ end
62
+
63
+ private
64
+
65
+ def fresh_state(last)
66
+ { 'version' => 1, 'catalog' => @catalog, 'seed' => SecureRandom.hex(8),
67
+ 'cursor' => 0, 'deferred' => [], 'last' => last }
68
+ end
69
+
70
+ def last_digest(state)
71
+ state['last'] if state.is_a?(Hash) && state['last'].is_a?(String) && HEX_DIGEST.match?(state['last'])
72
+ end
73
+
74
+ def valid_state?(state)
75
+ return false unless state.is_a?(Hash) && state.size == 6 && (state.keys - %w[catalog cursor deferred last seed version]).empty?
76
+ return false unless state['version'] == 1 && state['catalog'] == @catalog
77
+ return false unless state['seed'].is_a?(String) && SEED.match?(state['seed'])
78
+ return false unless state['last'].nil? || last_digest(state)
79
+
80
+ valid_positions?(state['cursor'], state['deferred'])
81
+ end
82
+
83
+ def valid_positions?(cursor, deferred)
84
+ cursor.is_a?(Integer) && cursor.between?(0, @pool.length) &&
85
+ deferred.is_a?(Array) && deferred.length <= 2 && deferred.uniq == deferred &&
86
+ deferred.all? { |position| position.is_a?(Integer) && position >= 0 && position < cursor }
87
+ end
88
+
89
+ # At most two positions can be blocked (last and exclude). Keep them unseen
90
+ # rather than dropping them, including when the next request changes exclude.
91
+ def next_position(order, state)
92
+ position = state['deferred'].find { |index| penalty(order[index], state).zero? }
93
+ return position if position
94
+
95
+ while state['cursor'] < order.length
96
+ position = state['cursor']
97
+ state['cursor'] += 1
98
+ return position if penalty(order[position], state).zero?
99
+
100
+ state['deferred'] << position
101
+ end
102
+ state['deferred'].min_by { |index| penalty(order[index], state) }
103
+ end
104
+
105
+ def penalty(frame, state)
106
+ (Digest::SHA256.hexdigest(frame.id) == state['last'] ? 2 : 0) + (frame.id == @exclude ? 1 : 0)
107
+ end
108
+ end
109
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'bible270/translations'
5
+ require 'bible270/scripture_frame_rotation'
5
6
 
6
7
  module Bible270
7
8
  module ScriptureFrames
@@ -156,7 +157,7 @@ module Bible270
156
157
  end
157
158
  private_class_method :default_disable_setting
158
159
 
159
- def random(exclude: nil)
160
+ def random(exclude: nil, reader: nil, session: nil)
160
161
  disabled_ids = disabled_default_ids
161
162
  pool = defaults.reject { |frame| disabled_ids.include?(frame.id) }
162
163
  if custom_available?
@@ -165,6 +166,8 @@ module Bible270
165
166
  translation: frame.translation, text: frame.text, attribution: frame.attribution)
166
167
  end
167
168
  end
169
+ return ScriptureFrameRotation.select(pool, reader: reader, session: session, exclude: exclude) if reader || session
170
+
168
171
  pool = pool.reject { |frame| frame.id == exclude } if pool.length > 1 && exclude.is_a?(String)
169
172
  pool.sample
170
173
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bible270
4
- VERSION = '1.18.1'
4
+ VERSION = '1.19.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.18.1
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft
@@ -283,6 +283,7 @@ files:
283
283
  - db/migrate/20260101000026_add_revert_to_bible270_plan_runs.rb
284
284
  - db/migrate/20260101000027_create_bible270_scripture_frames.rb
285
285
  - db/migrate/20260101000028_create_bible270_progress_sync.rb
286
+ - db/migrate/20260101000029_add_scripture_frame_rotation_to_bible270_readers.rb
286
287
  - lib/bible270.rb
287
288
  - lib/bible270/avatar_backfill.rb
288
289
  - lib/bible270/avatar_images.rb
@@ -303,6 +304,7 @@ files:
303
304
  - lib/bible270/progress_sync/client.rb
304
305
  - lib/bible270/reader_consistency.rb
305
306
  - lib/bible270/reader_progress_report.rb
307
+ - lib/bible270/scripture_frame_rotation.rb
306
308
  - lib/bible270/scripture_frames.rb
307
309
  - lib/bible270/translations.rb
308
310
  - lib/bible270/versification.rb