Skip to content

Commit

Permalink
Enhance leyning summaries for 2 and 3 sefer Torah
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Jul 16, 2021
1 parent e3bdf0c commit a8aafad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/leyning",
"version": "4.7.1",
"version": "4.7.2",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"keywords": [
"hebcal",
Expand Down
3 changes: 2 additions & 1 deletion src/leyning.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export function makeLeyningSummary(aliyot) {
}
if (aliyah.k === book && isChapVerseLater(aliyah.e, end)) {
end = aliyah.e;
chap = cv[0];
}
});
parts.push({k: book, b: begin, e: end});
Expand Down Expand Up @@ -375,7 +376,7 @@ export function getLeyningForParshaHaShavua(e, il=false) {
}
Object.values(fullkriyah).map((aliyah) => calculateNumVerses(aliyah));
const result = {
summary: `${book} ${raw.verses}`,
summary: makeLeyningSummary(fullkriyah),
fullkriyah: fullkriyah,
haftara: haftara,
};
Expand Down
23 changes: 18 additions & 5 deletions src/leyning.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ test('getLeyningForParshaHaShavua', (t) => {
break;
case 'Parashat Miketz':
const expected = {
summary: 'Genesis 41:1-44:17',
summary: 'Genesis 41:1-44:17; Numbers 7:54-8:4',
fullkriyah: {
'1': {k: 'Genesis', b: '41:1', e: '41:14', v: 14},
'2': {k: 'Genesis', b: '41:15', e: '41:38', v: 24},
Expand Down Expand Up @@ -209,7 +209,7 @@ test('getLeyningForParshaHaShavua', (t) => {
events2 = HebrewCalendar.calendar(options);
const miketz = events2.find((e) => e.getDesc() == 'Parashat Miketz');
const expected = {
summary: 'Genesis 41:1-44:17',
summary: 'Genesis 41:1-44:17; Numbers 28:9-15, 7:42-47',
fullkriyah: {
'1': {k: 'Genesis', b: '41:1', e: '41:14', v: 14},
'2': {k: 'Genesis', b: '41:15', e: '41:38', v: 24},
Expand Down Expand Up @@ -335,10 +335,10 @@ test('ignoreUserEvent-getLeyningForHoliday', (t) => {
t.is(a, undefined);
});

test('sukkot-chm', (t) => {
test('pesach-days-567', (t) => {
const april20 = new Date(2022, 3, 20);
const april21 = new Date(2022, 3, 21);
const events = HebrewCalendar.calendar({start: april20, end: april21});
const april22 = new Date(2022, 3, 22);
const events = HebrewCalendar.calendar({start: april20, end: april22});
const result = events.map((ev) => getLeyningForHoliday(ev, false));
const expected = [{
summary: 'Exodus 34:1-26; Numbers 28:19-25',
Expand All @@ -357,6 +357,19 @@ test('sukkot-chm', (t) => {
'3': {p: 36, k: 'Numbers', b: '9:9', e: '9:14', v: 6},
'4': {p: 41, k: 'Numbers', b: '28:19', e: '28:25', v: 7},
},
},
{
summary: 'Exodus 13:17-15:26; Numbers 28:19-25',
fullkriyah: {
'1': {p: 16, k: 'Exodus', b: '13:17', e: '13:22', v: 6},
'2': {p: 16, k: 'Exodus', b: '14:1', e: '14:8', v: 8},
'3': {p: 16, k: 'Exodus', b: '14:9', e: '14:14', v: 6},
'4': {p: 16, k: 'Exodus', b: '14:15', e: '14:25', v: 11},
'5': {p: 16, k: 'Exodus', b: '14:26', e: '15:26', v: 32},
'M': {p: 41, k: 'Numbers', b: '28:19', e: '28:25', v: 7},
},
haftara: 'II Samuel 22:1 - 22:51',
haftaraNumV: 51,
}];
t.deepEqual(result, expected);
});
Expand Down

0 comments on commit a8aafad

Please sign in to comment.