Skip to content

Commit

Permalink
Remove waste type mapping for pickup dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jey-Cee committed Nov 19, 2024
1 parent af653c5 commit 7f7f9e5
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions lib/source/api-abfallio.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,37 +475,26 @@ class SourceApiAbfallIo extends BaseSource {
}
const pickupData = await this.getApiCached(config, `abfallio-pickups-${provider}-${cityId}.ics`);

const wasteTypeMap = {
Restmüll: { id: '333', name: 'Restmüll 120l/240l', color: '#242425' },
Biomüll: { id: '50', name: 'Biomüll', color: '#824300' },
'Gelbe Tonne': { id: '299', name: 'Wertstoffe', color: '#f4b324' },
Altpapier: { id: '53', name: 'Papier 120l/240l', color: '#2d76ba' },
};

const events = ical.parseICS(pickupData);

const appointments = [];

for (const key in events) {
const event = events[key];
if (event.type === 'VEVENT') {
const summary = event.summary || '';

const localDate = new Date(event.start).toLocaleDateString('en-CA');
const description = event.description || '';

const wasteType = wasteTypeMap[summary] || {};

const appointment = {
id: `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
date: localDate,
time: null,
location: null,
note: description,
wasteType: {
id: wasteType.id || '',
name: wasteType.name || '',
color: wasteType.color || '',
id: '',
name: event.summary,
color: '',
internals: {
pdfLegend: null,
iconLow: null,
Expand Down

0 comments on commit 7f7f9e5

Please sign in to comment.