From 7f924a633199788c920e400ab19c7f8cda4cb34f Mon Sep 17 00:00:00 2001 From: Elisabeth Date: Mon, 16 Dec 2024 15:55:26 -0500 Subject: [PATCH] translate mappedVerseId to a startChapter/Verse/bookNumber format before getting the BibleText --- src/Aquifer.Common/Utilities/BibleTextUtilities.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Aquifer.Common/Utilities/BibleTextUtilities.cs b/src/Aquifer.Common/Utilities/BibleTextUtilities.cs index 09ea8dde..c0addb1d 100644 --- a/src/Aquifer.Common/Utilities/BibleTextUtilities.cs +++ b/src/Aquifer.Common/Utilities/BibleTextUtilities.cs @@ -12,9 +12,11 @@ public static async Task> GetTextsByBibleId(int bookNumber, var verseId = BibleUtilities.GetVerseId(bookNumber, chapter, verse); var mappedVerseId = await cachingService.GetVersificationMapping(bibleId, verseId, ct); + var (mappedBookNumber, mappedChapter, mappedVerse) = BibleUtilities.TranslateVerseId(mappedVerseId); - return await dbContext.BibleTexts - .Where(bt => bt.VerseNumber == mappedVerseId && bt.ChapterNumber == chapter && bt.BibleId == bibleId).Select(b => new Chapter + var bibleTexts = await dbContext.BibleTexts + .Where(bt => bt.VerseNumber == mappedVerse && bt.ChapterNumber == mappedChapter && bt.BookId == mappedBookNumber && + bt.BibleId == bibleId).Select(b => new Chapter { Number = b.ChapterNumber, Verse = new ChapterVerse @@ -23,6 +25,7 @@ public static async Task> GetTextsByBibleId(int bookNumber, Text = b.Text } }).ToListAsync(ct); + return bibleTexts; } }