Skip to content

Commit 0830d97

Browse files
committed
Fix book logic
1 parent 9d729bb commit 0830d97

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/SIL.Machine/PunctuationAnalysis/ParatextProjectQuoteConventionDetector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ string bookId in Canon
3434
.Select(num => Canon.BookNumberToId(num))
3535
)
3636
{
37-
if (includeChapters != null && includeChapters.ContainsKey(Canon.BookIdToNumber(bookId)))
37+
if (includeChapters != null && !includeChapters.ContainsKey(Canon.BookIdToNumber(bookId)))
3838
continue;
3939

4040
string fileName = _settings.GetBookFileName(bookId);

src/SIL.Machine/PunctuationAnalysis/UsfmStructureExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public List<Chapter> GetChapters(Dictionary<int, List<int>> includeChapters = nu
142142
foreach (TextSegment textSegment in _textSegments)
143143
{
144144
if (textSegment.Book != null)
145-
currentBook = Canon.BookIdToNumber(textSegment.Book) - 1; //make 0-indexed
145+
currentBook = Canon.BookIdToNumber(textSegment.Book);
146146
if (textSegment.Chapter > 0)
147147
currentChapter = textSegment.Chapter;
148148
if (includeChapters != null && currentBook > 0)

tests/SIL.Machine.Tests/Corpora/ParatextProjectQuoteConvetionDetectorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public QuoteConventionAnalysis GetQuoteConvention(string? scriptureRange = null)
142142
{
143143
chapters = ScriptureRangeParser
144144
.GetChapters(scriptureRange)
145-
.ToDictionary(kvp => Canon.BookIdToNumber(kvp.Key) - 1, kvp => kvp.Value); // make 0-indexed
145+
.ToDictionary(kvp => Canon.BookIdToNumber(kvp.Key), kvp => kvp.Value);
146146
}
147147
return Detector.GetQuoteConventionAnalysis(includeChapters: chapters);
148148
}

0 commit comments

Comments
 (0)