MAID: cleanup uneeded last verse code now that you store that data in Reference

This commit is contained in:
jason.wall 2017-08-23 18:02:25 -04:00
parent e3b84c7913
commit 7c91fc472c
3 changed files with 11 additions and 10 deletions

View File

@ -105,4 +105,4 @@
"android"
]
}
}
}

View File

@ -53,7 +53,9 @@ export class Passage implements OnInit
next()
{
if (this.ref.Section.end.verse !== '*' && this.ref.Section.end.verse !== this.data.lastverse.toString())
let last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)].toString();
if (this.ref.Section.end.verse !== '*' && this.ref.Section.end.verse !== last_verse_for_end)
this.ref.Section.end.chapter = this.ref.Section.end.chapter;
else
this.ref.Section.end.chapter = (parseInt(this.ref.Section.end.chapter) + 1).toString();
@ -91,6 +93,8 @@ export class Passage implements OnInit
expand()
{
let last_verse_for_end = this.ref.Section.end.book.chapters[parseInt(this.ref.Section.end.chapter)];
// if your verse is at the beginning, to go the prev chapter and add 3 verses from that
if (parseInt(this.ref.Section.start.verse) < 4)
{
@ -106,18 +110,18 @@ export class Passage implements OnInit
this.ref.Section.start.verse = (parseInt(this.ref.Section.start.verse) - 3).toString();
// if your verse is at the end, go to the next chapter
if (this.ref.Section.end.verse === '*' || parseInt(this.ref.Section.end.verse) + 3 > this.data.lastverse)
if (this.ref.Section.end.verse === '*' || parseInt(this.ref.Section.end.verse) + 3 > last_verse_for_end)
{
this.ref.Section.end.chapter = (parseInt(this.ref.Section.end.chapter) + 1).toString();
if (this.ref.Section.end.verse === '*')
this.ref.Section.end.verse = '3';
else
this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - this.data.lastverse).toString();
this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - last_verse_for_end).toString();
if (this.ref.Section.end.chapter === (this.ref.Section.end.book.last_chapter + 1).toString())
{
this.ref.Section.end.chapter = this.ref.Section.end.book.last_chapter.toString();
this.ref.Section.end.verse = this.data.lastverse.toString();
this.ref.Section.end.verse = last_verse_for_end.toString();
}
}
else // or add 3 verses

View File

@ -32,8 +32,7 @@ export class BibleService
testament: '',
ref: Reference.toString(section),
status: 0,
msg: ':)',
lastverse: 0
msg: ':)'
};
if (Number(section.start.chapter) > section.start.book.last_chapter)
@ -121,7 +120,6 @@ export class BibleService
"ch": this.chapters[j].ch,
"vss": vss
});
this.result.lastverse = this.chapters[j].vss.length;
}
@ -145,8 +143,7 @@ export type BiblePassageResult = {
testament: string,
ref: string,
status: number,
msg: string,
lastverse: number,
msg: string,
}
type BiblePassage = {