diff --git a/src/README.md b/src/README.md index 290cef49..cf973f4c 100644 --- a/src/README.md +++ b/src/README.md @@ -20,3 +20,4 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github. - setup CI/CD - ignore reserved search words (the ones that are too big to fit in the index) - migration path for old data to new +- strongs numbers with more than one number should appear in tabs or you need to update your text to assign only one number per word(s) diff --git a/src/src/app/components/passage/passage-card.component.ts b/src/src/app/components/passage/passage-card.component.ts index 267cc41f..a3022c56 100644 --- a/src/src/app/components/passage/passage-card.component.ts +++ b/src/src/app/components/passage/passage-card.component.ts @@ -59,75 +59,81 @@ export class PassageCardComponent extends CardComponent implements OnInit { } next() { - const lastVerseForEnd = this.ref.section.book.chapters[this.ref.section.end.chapter]; + const newRef = new BibleReference(this.ref.toString()); - if (this.ref.section.end.verse !== 0 && this.ref.section.end.verse !== lastVerseForEnd) { - this.ref.section.end.chapter = this.ref.section.end.chapter; + const lastVerseForEnd = newRef.section.book.chapters[newRef.section.end.chapter]; + + if (newRef.section.end.verse !== 0 && newRef.section.end.verse !== lastVerseForEnd) { + newRef.section.end.chapter = newRef.section.end.chapter; } else { - this.ref.section.end.chapter = this.ref.section.end.chapter + 1; + newRef.section.end.chapter = newRef.section.end.chapter + 1; } - this.ref.section.start.chapter = this.ref.section.end.chapter; - this.ref.section.start.verse = 1; - this.ref.section.end.verse = this.ref.section.book.chapters[this.ref.section.end.chapter]; + newRef.section.start.chapter = newRef.section.end.chapter; + newRef.section.start.verse = 1; + newRef.section.end.verse = newRef.section.book.chapters[newRef.section.end.chapter]; - this.appService.updatePassage(this.cardItem, this.ref); + this.appService.updatePassage(this.cardItem, newRef); } prev() { - if (this.ref.section.start.verse !== 1) { - this.ref.section.start.chapter = this.ref.section.start.chapter; + const newRef = new BibleReference(this.ref.toString()); + + if (newRef.section.start.verse !== 1) { + newRef.section.start.chapter = newRef.section.start.chapter; } else { - this.ref.section.start.chapter = this.ref.section.start.chapter - 1; + newRef.section.start.chapter = newRef.section.start.chapter - 1; } - this.ref.section.end.chapter = this.ref.section.start.chapter; - this.ref.section.start.verse = 1; - this.ref.section.end.verse = this.ref.section.book.chapters[this.ref.section.end.chapter]; + newRef.section.end.chapter = newRef.section.start.chapter; + newRef.section.start.verse = 1; + newRef.section.end.verse = newRef.section.book.chapters[newRef.section.end.chapter]; - this.appService.updatePassage(this.cardItem, this.ref); + this.appService.updatePassage(this.cardItem, newRef); } expand() { - const lastVerseForEnd = this.ref.section.book.chapters[this.ref.section.end.chapter]; + const newRef = new BibleReference(this.ref.toString()); + + const lastVerseForEnd = newRef.section.book.chapters[newRef.section.end.chapter]; // if your verse is at the beginning, to go the prev chapter and add 3 verses from that - if (this.ref.section.start.verse < 4) { - this.ref.section.start.chapter = this.ref.section.start.chapter - 1; - this.ref.section.start.verse = - this.ref.section.book.chapters[this.ref.section.start.chapter] - (3 - this.ref.section.start.verse); - if (this.ref.section.start.chapter === 0) { - this.ref.section.start.chapter = 1; - this.ref.section.start.verse = 1; + if (newRef.section.start.verse < 4) { + newRef.section.start.chapter = newRef.section.start.chapter - 1; + newRef.section.start.verse = + newRef.section.book.chapters[newRef.section.start.chapter] - (3 - newRef.section.start.verse); + if (newRef.section.start.chapter === 0) { + newRef.section.start.chapter = 1; + newRef.section.start.verse = 1; } } else { // or go back 3 verses - this.ref.section.start.verse = this.ref.section.start.verse - 3; + newRef.section.start.verse = newRef.section.start.verse - 3; } // if your verse is at the end, go to the next chapter - if (this.ref.section.end.verse === 0 || this.ref.section.end.verse + 3 > lastVerseForEnd) { - this.ref.section.end.chapter = this.ref.section.end.chapter + 1; - if (this.ref.section.end.verse === 0) { - this.ref.section.end.verse = 3; + if (newRef.section.end.verse === 0 || newRef.section.end.verse + 3 > lastVerseForEnd) { + newRef.section.end.chapter = newRef.section.end.chapter + 1; + if (newRef.section.end.verse === 0) { + newRef.section.end.verse = 3; } else { - this.ref.section.end.verse = this.ref.section.end.verse + 3 - lastVerseForEnd; + newRef.section.end.verse = newRef.section.end.verse + 3 - lastVerseForEnd; } - if (this.ref.section.end.chapter === this.ref.section.book.lastChapter + 1) { - this.ref.section.end.chapter = this.ref.section.book.lastChapter; - this.ref.section.end.verse = lastVerseForEnd; + if (newRef.section.end.chapter === newRef.section.book.lastChapter + 1) { + newRef.section.end.chapter = newRef.section.book.lastChapter; + newRef.section.end.verse = lastVerseForEnd; } } else { // or add 3 verses - this.ref.section.end.verse = this.ref.section.end.verse + 3; + newRef.section.end.verse = newRef.section.end.verse + 3; } - if (this.ref.section.start.verse === 0) { - this.ref.section.start.verse = 1; + if (newRef.section.start.verse === 0) { + newRef.section.start.verse = 1; } - this.appService.updatePassage(this.cardItem, this.ref); + this.appService.updatePassage(this.cardItem, newRef); } openNote(note: NoteItem) {