@@ -17,6 +17,23 @@ async function loadEvents(query = defaultQuery) {
1717 buildCalendar ( evnts ) ;
1818}
1919
20+ const aven_cities = [
21+ "Bannalec" , "Beg-Meil" , "Concarneau" , "Elliant" , "LaForêt-Fouesnant" , "Pleuven" ,
22+ "Pont-Aven" , "Rosporden" , "Fouesnant" , "Melgven" , "Moelansurmer" , "Moëlan-sur-Mer" ,
23+ "Kervaziou" , "Scaër" , "Névez" , "Nizon" , "Port-la-Forêt" , "Quimperlé" , "Saint-Philibert" ,
24+ "Saint-Yvi" , "Tourch" , "Trégunc" , "La Forêt-Fouesnant" , "Mellac" , "Querrien" , "Autre"
25+ ]
26+
27+ // Add missing location description for cities in Aven, aggregated from other OACalendars out of Kerlandrier
28+ function addLocDescription ( evnts ) {
29+ evnts . events . forEach ( ( evnt ) => {
30+ if ( ! evnt . location . description && aven_cities . some ( city => evnt . location . city ?. includes ( city ) ) ) {
31+ evnt . location . description = "AVEN" ;
32+ }
33+ } ) ;
34+ return evnts ;
35+ }
36+
2037function buildCalendar ( evnts = null , areaFilters = [ ] , dateFilter = "" ) {
2138 // Init date filters as Date
2239 const startDate = dateFilter ? new Date ( dateFilter . split ( "," ) [ 0 ] ) : null ;
@@ -25,6 +42,9 @@ function buildCalendar(evnts = null, areaFilters = [], dateFilter = "") {
2542 // Get events from localStorage
2643 if ( evnts === null ) evnts = JSON . parse ( localStorage . getItem ( "events" ) ) ;
2744
45+ // Add missing location description
46+ evnts = addLocDescription ( evnts ) ;
47+
2848 // Filter events: area & date
2949 const eventsRaw = evnts . events ; // Array of { title, onlineAccessLink... }
3050 const eventsFiltered = eventsRaw // Array of { title, onlineAccessLink... } but filtered based on location.description and selectedMonth
0 commit comments