diff --git a/database/schedule.js b/database/schedule.js index ff22b95..0b3f7d4 100644 --- a/database/schedule.js +++ b/database/schedule.js @@ -109,6 +109,7 @@ export const updateWeekType = async ({ weekID, type }) => { const updatedMembers = [] switch (type) { case WEEK_TYPES.assembly.value: + case WEEK_TYPES.memorial.value: for (const [k, v] of Object.entries(week.assignments || {})) { if (v) { for (const field of ASSIGNEE_FIELDS) { diff --git a/database/scraper.js b/database/scraper.js index 3a1cbb4..1e96db6 100644 --- a/database/scraper.js +++ b/database/scraper.js @@ -15,14 +15,15 @@ export default function scrapeWOL (date) { return rp({ uri, transform }) .then($ => { // Check schedule is online first - if (!$('#p2').text()) throw new Error('Week not yet available') + const weeklyBibleReading = $('#p2 strong', 'header').text() + if (!weeklyBibleReading) throw new Error('Week not yet available') // Load as much static information as possible const update = { scraped: true, - weeklyBibleReading: $('#p2').text(), + weeklyBibleReading, songs: [ - $('#p3').text().trim(), + $('#p3', '#section1').text().trim(), $(paragraphSelector, '#section4').first().text().trim(), $(paragraphSelector, '#section4').last().text().trim() ], diff --git a/src/components/Schedule/ScheduleWeek.vue b/src/components/Schedule/ScheduleWeek.vue index 16105ac..7dd2e51 100644 --- a/src/components/Schedule/ScheduleWeek.vue +++ b/src/components/Schedule/ScheduleWeek.vue @@ -59,6 +59,14 @@ + + + + +

+ + + @@ -89,21 +97,11 @@ warning -

- There was an error scraping this week's data (most likely because the information isn't available yet on WOL) if you believe this is a mistake contact support -

-
-
- - - - - - group - -

- Assembly Week -

+
+

There was an error scraping this week's data

+

This is most likely because the information isn't available yet on WOL, but may also be because of a special week such as the Memorial

+

If you believe this is a mistake please contact support

+
diff --git a/src/constants.js b/src/constants.js index 4e99fa3..386e905 100644 --- a/src/constants.js +++ b/src/constants.js @@ -46,5 +46,6 @@ export const LANGUAGE_GROUPS = ['English', 'Portuguese'] export const WEEK_TYPES = { normal: { label: 'Normal', value: 0 }, assembly: { label: 'Assembly', value: 1 }, - coVisit: { label: 'CO Visit', value: 2 } + coVisit: { label: 'CO Visit', value: 2 }, + memorial: { label: 'Memorial', value: 3 } } diff --git a/src/plugins/pdfMake.js b/src/plugins/pdfMake.js index a805016..1357dd2 100644 --- a/src/plugins/pdfMake.js +++ b/src/plugins/pdfMake.js @@ -167,16 +167,15 @@ export function generateSchedule (weeks, month) { const [, month, day] = date.split('-') const titleDay = day.charAt(0) === '0' ? day.charAt(1) : day const titleMonth = MONTHS[+month - 1] - stack.push({ - text: `${titleDay} ${titleMonth} | WEEKLY BIBLE READING: ${weeklyBibleReading}`, - fontSize: 14, - bold: true - }) + let titleText = `${titleDay} ${titleMonth}` + if (weeklyBibleReading) titleText += ` | WEEKLY BIBLE READING: ${weeklyBibleReading}` + stack.push({ text: titleText, fontSize: 14, bold: true }) // Just add a block of text for assembly weeks - if (type === WEEK_TYPES.assembly.value) { + if (type === WEEK_TYPES.assembly.value || type === WEEK_TYPES.memorial.value) { + const blockText = type === WEEK_TYPES.assembly.value ? 'Assembly Week' : 'Memorial Week' stack.push({ text: 'No Meeting', fontSize: 32, bold: true, alignment: 'center', margin: [0, 132, 0, 12] }) - stack.push({ text: 'Assembly Week', fontSize: 18, alignment: 'center', margin: [0, 0, 0, 132] }) + stack.push({ text: blockText, fontSize: 18, alignment: 'center', margin: [0, 0, 0, 132] }) stack.push(createScheduleSeparator()) return } @@ -391,7 +390,8 @@ export function generateAssignmentSlips (weeks, month) { const slips = [] const VALID_TYPES = ['bibleReading', 'initialCall', 'returnVisit', 'bibleStudy', 'studentTalk'] for (const week of weeks) { - const { assignments } = week + const { type, assignments } = week + if (type === WEEK_TYPES.assembly.value || type === WEEK_TYPES.memorial.value) continue for (let i = 0; i <= 4; i++) { // treat index 0 as the bibleReading, else extract a student talk const talk = i === 0 ? assignments.bibleReading : assignments['studentTalk' + i]