diff --git a/build.js b/build.js index 11e9c74..75a6dfb 100644 --- a/build.js +++ b/build.js @@ -36,7 +36,7 @@ calendars.forEach(function(filepath) { const icalJs = require('ical.js'); const IcalExpander = require('ical-expander'); const ics = jetpack.read(filepath); - const icalExpander = new IcalExpander({ ics, maxIterations: 50 }); + const icalExpander = new IcalExpander({ ics, maxIterations: 55 }); const events = icalExpander.all(); const filename = `${path.parse(filepath).name}.json`; const jcalData = icalJs.parse(ics); @@ -48,11 +48,12 @@ calendars.forEach(function(filepath) { const jsonData = { "filename": filename, "name": comp.getFirstPropertyValue('x-wr-calname'), + "description": comp.getFirstPropertyValue('x-wr-caldesc'), "icalPath": filepath, "jsonPath": jsonPath.substring(2), "lastGenerated": new Date().toJSON(), "lastModified": fileProperties.modifyTime, - "description": comp.getFirstPropertyValue('x-wr-caldesc'), + "totalCollections": 0, "collectionDates": [] }; @@ -88,6 +89,7 @@ calendars.forEach(function(filepath) { const allEvents = [].concat(mappedEvents, mappedOccurrences) .sort((a,b) => new Date(a.collectionDate) - new Date(b.collectionDate)); + jsonData['totalCollections'] = allEvents.length; jsonData['collectionDates'] = allEvents; // Write to JSON folder for public API diff --git a/json-endpoints.html b/json-endpoints.html index 42d69fc..acfb711 100644 --- a/json-endpoints.html +++ b/json-endpoints.html @@ -16,11 +16,12 @@

{{ page.title }}

{ "filename": "gedling_borough_council_friday_g4_bin_schedule.json", "name": "Gedling Borough Council Bin Day 2023/24 Friday G4", + "description": "https://apps.gedling.gov.uk/refuse/data/FridayG4-2024.pdf", "icalPath": "ical/gedling_borough_council_friday_g4_bin_schedule.ics", "jsonPath": "json/gedling_borough_council_friday_g4_bin_schedule.json", "lastGenerated": "2024-06-29T18:45:14.023Z", "lastModified": "2024-06-17T14:12:39.206Z", - "description": "https://apps.gedling.gov.uk/refuse/data/FridayG4-2024.pdf", + "totalCollections": 53, "collectionDates": [ ... ]