diff options
Diffstat (limited to 'scripts/update-library-dates.mjs')
| -rw-r--r-- | scripts/update-library-dates.mjs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/update-library-dates.mjs b/scripts/update-library-dates.mjs index 74b9302..a41fae1 100644 --- a/scripts/update-library-dates.mjs +++ b/scripts/update-library-dates.mjs @@ -109,6 +109,7 @@ async function main() { const inTable = new Map(); const changes = []; + const skipped = []; for (const row of rows) { const m = (row.source || '').match(LIB_SOURCE_RE); @@ -116,6 +117,13 @@ async function main() { const id = m[1]; inTable.set(id, { name: row.title, datesCell: row.date, row }); + // 市報など他の出典を併記している行は、そちらの日付を優先して自動同期しない + // (図書館のカレンダーに誤りがある事例が判明しているため)。 + if (/市報/.test(row.source || '')) { + skipped.push(row.title); + continue; + } + const ev = events.get(id); if (!ev || ev.dates.size === 0) continue; const next = formatDates(ev.dates, ev.dates.size === 1); @@ -123,6 +131,10 @@ async function main() { } console.log(`図書館の予定: カレンダー ${events.size}件 / 表 ${inTable.size}件(${months}か月分を取得)`); + if (skipped.length > 0) { + console.log('(市報の日付を優先し、自動同期しない行)'); + for (const name of skipped) console.log(`- ${name}`); + } if (changes.length === 0) { console.log('日付の変更はありません。'); |
