Skip to content

Commit

Permalink
Fix comparison between event attribute keys during upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephVolosin committed Jan 10, 2025
1 parent a284cae commit 456dabb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/external-source/ExternalSourceManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,16 @@
// Check that all the External Event Types for the source to-be-uploaded exist
const newSourceExternalEventTypes: { [event_type: string]: string[] } = {};
for (const event of externalSource.events) {
const currentKeySet = new Set(Object.keys(event.attributes));
if (newSourceExternalEventTypes[event.event_type] === undefined) {
newSourceExternalEventTypes[event.event_type] = Object.keys(event.attributes);
} else if (newSourceExternalEventTypes[event.event_type] !== Object.keys(event.attributes)) {
// if there is a mismatch, cause error
} else if (newSourceExternalEventTypes[event.event_type].length === Object.keys(event.attributes).length) {
const attributeInconsistencies = currentKeySet.difference(new Set(newSourceExternalEventTypes[event.event_type]))
if (attributeInconsistencies.size !== 0) {
uploadDisabledMessage = 'Event attributes are inconsistent across events of type ' + event.event_type + '.';
return false;
}
} else {
uploadDisabledMessage = 'Event attributes are inconsistent across events of type ' + event.event_type + '.';
return false;
}
Expand Down

0 comments on commit 456dabb

Please sign in to comment.