Skip to content

Change bgt to nbv21#625

Merged
lodewiges merged 1 commit intostagingfrom
feature/improve-bible-translation
Apr 10, 2026
Merged

Change bgt to nbv21#625
lodewiges merged 1 commit intostagingfrom
feature/improve-bible-translation

Conversation

@lodewiges
Copy link
Copy Markdown
Contributor

@lodewiges lodewiges commented Apr 10, 2026

Fix the bible translation

Summary by CodeRabbit

  • Bug Fixes
    • Updated daily verse retrieval to source from an alternative translation provider, maintaining API compatibility and response structure.

Copilot AI review requested due to automatic review settings April 10, 2026 13:17
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

The parse_verse method in the daily verses controller was updated to source data from different upstream fields. The data source changed from bgt variant to nbv21 variant for copyrights and verse text, while maintaining the same output JSON structure.

Changes

Cohort / File(s) Summary
Verse Data Source Update
app/controllers/v1/daily_verses_controller.rb
Updated parse_verse method to extract copyrights and text from nbv21 fields instead of bgt fields in the upstream verse payload.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 From bgt to nbv21 we hop along,
New verses flow, the data source is strong,
Same structure shines in every line,
Just different fields, a source so fine! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description 'Fix the bible translation' is vague and lacks required template sections: no summary of actual changes, no checklist items completed, no mention of related issues or testing performed. Add detailed summary of changes, confirm database migration steps if applicable, and provide context about what was fixed in the bible translation field mapping.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Change bgt to nbv21' directly describes the main code change: updating field references from 'bgt' to 'nbv21' in the bible verse translation data source.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-bible-translation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
app/controllers/v1/daily_verses_controller.rb (2)

23-25: Add a test assertion for translation selection (nbv21).

Current request coverage (spec/requests/v1/daily_verses_controller/index_spec.rb, Line 1-42) checks caching and status, but not which translation key is serialized. A focused assertion would prevent silent regression back to another key.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/controllers/v1/daily_verses_controller.rb` around lines 23 - 25, Add an
assertion in the existing request spec
(spec/requests/v1/daily_verses_controller/index_spec.rb) to verify the
controller serializes the expected translation key "nbv21": after performing the
GET and parsing the JSON response, assert that the returned verse object
includes the nbv21 fields (e.g.,
response_body['data'][0]['attributes']['content'] or the specific key you
expect) and that the content matches the sanitized string you expect for nbv21;
this ensures the controller code paths that set copyright, reference, and
content using the nbv21 keys in DailyVersesController are exercised and prevents
silent fallback to another translation.

23-25: Avoid duplicating the translation key literal.

'nbv21' appears in multiple places; extracting it to a constant will reduce drift if this key changes again.

Refactor sketch
 class V1::DailyVersesController < V1::ApplicationController
+  TRANSLATION_KEY = 'nbv21'.freeze
+
   def parse_verse(response)
     data = response['data'][0]
-    copyright = ActionView::Base.full_sanitizer.sanitize(response['copyrights']['nbv21'])
+    copyright = ActionView::Base.full_sanitizer.sanitize(response['copyrights'][TRANSLATION_KEY])
     reference = ActionView::Base.full_sanitizer.sanitize(data['source'])
-    content = ActionView::Base.full_sanitizer.sanitize(data['text']['nbv21'])
+    content = ActionView::Base.full_sanitizer.sanitize(data['text'][TRANSLATION_KEY])
     { data: [{ id: 1, type: 'daily_verse', attributes:
       { copyright:, reference:, content: } }] }
   end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/controllers/v1/daily_verses_controller.rb` around lines 23 - 25, Extract
the repeated translation key literal 'nbv21' into a single constant (e.g.
NBV21_KEY or TRANSLATION_KEY) at the top of the DailyVersesController (or as a
private constant inside the controller) and replace the three literal uses in
the assignments to copyright, reference, and content with that constant; ensure
the constant name is descriptive and update any other occurrences in this
controller to reference it so future key changes require a single edit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/controllers/v1/daily_verses_controller.rb`:
- Around line 23-25: Add an assertion in the existing request spec
(spec/requests/v1/daily_verses_controller/index_spec.rb) to verify the
controller serializes the expected translation key "nbv21": after performing the
GET and parsing the JSON response, assert that the returned verse object
includes the nbv21 fields (e.g.,
response_body['data'][0]['attributes']['content'] or the specific key you
expect) and that the content matches the sanitized string you expect for nbv21;
this ensures the controller code paths that set copyright, reference, and
content using the nbv21 keys in DailyVersesController are exercised and prevents
silent fallback to another translation.
- Around line 23-25: Extract the repeated translation key literal 'nbv21' into a
single constant (e.g. NBV21_KEY or TRANSLATION_KEY) at the top of the
DailyVersesController (or as a private constant inside the controller) and
replace the three literal uses in the assignments to copyright, reference, and
content with that constant; ensure the constant name is descriptive and update
any other occurrences in this controller to reference it so future key changes
require a single edit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d00875a6-1925-4f15-be5c-9ae0bc344608

📥 Commits

Reviewing files that changed from the base of the PR and between 687c75d and 189e451.

📒 Files selected for processing (1)
  • app/controllers/v1/daily_verses_controller.rb

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the daily verse API response parsing to use the NBV21 translation fields instead of BGT.

Changes:

  • Switches parsed copyright source from response['copyrights']['bgt'] to response['copyrights']['nbv21']
  • Switches parsed verse content from data['text']['bgt'] to data['text']['nbv21']

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +25
copyright = ActionView::Base.full_sanitizer.sanitize(response['copyrights']['nbv21'])
reference = ActionView::Base.full_sanitizer.sanitize(data['source'])
content = ActionView::Base.full_sanitizer.sanitize(data['text']['bgt'])
content = ActionView::Base.full_sanitizer.sanitize(data['text']['nbv21'])
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request spec for this endpoint only checks status/caching and does not assert which translation is returned. Since this change switches the translation key from bgt to nbv21, please add an assertion in the existing request spec that verifies attributes.content and attributes.copyright are derived from the nbv21 fields (e.g., by comparing against the VCR cassette response). This will prevent silent regressions if the translation key changes again or the API response shape differs.

Copilot uses AI. Check for mistakes.
@lodewiges lodewiges enabled auto-merge April 10, 2026 13:22
@lodewiges lodewiges disabled auto-merge April 10, 2026 13:22
@lodewiges lodewiges merged commit 4be1ca2 into staging Apr 10, 2026
8 checks passed
@lodewiges lodewiges deleted the feature/improve-bible-translation branch April 10, 2026 13:27
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.92%. Comparing base (ca06416) to head (189e451).
⚠️ Report is 3 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging     #625   +/-   ##
========================================
  Coverage    99.92%   99.92%           
========================================
  Files          197      197           
  Lines         2665     2665           
========================================
  Hits          2663     2663           
  Misses           2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants