diff --git a/package.json b/package.json index 685c944..1ea3c22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hebcal/rest-api", - "version": "3.7.1", + "version": "3.7.2", "author": "Michael J. Radwin (https://github.com/mjradwin)", "keywords": [ "hebcal" diff --git a/src/classic-rest-api.spec.js b/src/classic-rest-api.spec.js index 5967841..e17bbdf 100644 --- a/src/classic-rest-api.spec.js +++ b/src/classic-rest-api.spec.js @@ -71,7 +71,7 @@ test('eventToClassicApiObject', (t) => { '3': 'Exodus 19:14 - 19:19', '4': 'Exodus 19:20 - 20:14', '5': 'Exodus 20:15 - 20:23', - 'torah': 'Exodus 19:1-20:23; Numbers 28:26-28:31', + 'torah': 'Exodus 19:1-20:23; Numbers 28:26-31', 'haftarah': 'Ezekiel 1:1 - 1:28; 3:12', 'maftir': 'Numbers 28:26 - 28:31', }, diff --git a/src/common.js b/src/common.js index a0eaeed..9c96b7e 100644 --- a/src/common.js +++ b/src/common.js @@ -229,41 +229,23 @@ export function makeTorahMemoText(ev, il) { if (mask & HOLIDAY_IGNORE_MASK) { return ''; } - let reading; + const reading = (mask & flags.PARSHA_HASHAVUA) ? + leyning.getLeyningForParshaHaShavua(ev, il) : + leyning.getLeyningForHoliday(ev, il); let memo = ''; - if (mask & flags.PARSHA_HASHAVUA) { - reading = leyning.getLeyningForParshaHaShavua(ev, il); - memo = `Torah: ${reading.summary}`; - if (reading.reason) { - ['7', 'M'].forEach((num) => { - const special = reading.reason[num]; - if (special) { - const aname = num === '7' ? '7th aliyah' : 'Maftir'; - const verses = leyning.formatAliyahWithBook(reading.fullkriyah[num]); - memo += `\n${aname}: ${verses} | ${special}`; - } - }); + if (reading && (reading.summary || reading.haftara)) { + if (reading.summary) { + memo += `Torah: ${reading.summary}`; + } + if (reading.summary && reading.haftara) { + memo += '\n'; } if (reading.haftara) { - memo += '\nHaftarah: ' + reading.haftara; + memo += 'Haftarah: ' + reading.haftara; if (reading.reason && reading.reason.haftara) { memo += ' | ' + reading.reason.haftara; } } - } else { - reading = leyning.getLeyningForHoliday(ev, il); - if (reading && (reading.summary || reading.haftara)) { - if (reading.summary) { - memo += `Torah: ${reading.summary}`; - } - if (reading.summary && reading.haftara) { - memo += '\n'; - } - if (reading.haftara) { - memo += 'Haftarah: ' + reading.haftara; - } - return memo; - } } if (reading && reading.sephardic) { memo += '\nHaftarah for Sephardim: ' + reading.sephardic; diff --git a/src/common.spec.js b/src/common.spec.js index a15467d..83a2f3a 100644 --- a/src/common.spec.js +++ b/src/common.spec.js @@ -79,9 +79,7 @@ test('makeTorahMemoText', (t) => { }); const memo = makeTorahMemoText(events[0], false).split('\n'); const expected = [ - 'Torah: Exodus 21:1-24:18', - '7th aliyah: Numbers 28:9 - 28:15 | Shabbat Shekalim (on Rosh Chodesh)', - 'Maftir: Exodus 30:11 - 30:16 | Shabbat Shekalim (on Rosh Chodesh)', + 'Torah: Exodus 21:1-24:18; Numbers 28:9-15; Exodus 30:11-16', 'Haftarah: II Kings 12:1 - 12:17 | Shabbat Shekalim (on Rosh Chodesh)', ]; t.deepEqual(memo, expected);