Skip to content

Commit

Permalink
don't filter deleted additions twice
Browse files Browse the repository at this point in the history
I found an edge case where if an old addition (ie one that was already processed) was edited, there would be duplicates; both the old and new version would show up (until the new one got processed).

This is because we were first applying the 'not deleted' filter to unprocessed entries. Then after they are merged with processed entreis we applied it to the merged copy. This didn't work for the edge case because the DELETED entry was already filtered out the first time, so the processed original entry just sticks around.

This fix ensures that the 'not deleted' filter ONLY happens once processed+unprocessed are merged together, this way the filter considers all entries at once
  • Loading branch information
JGreenlee committed May 9, 2024
1 parent 02655ba commit cb1e45b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions www/js/survey/inputMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,8 @@ export function getAdditionsForTimelineEntry(
return [];
}

// get additions that have not been deleted and filter out additions that do not start within the bounds of the timeline entry
const notDeleted = getNotDeletedCandidates(additionsList);
const matchingAdditions = notDeleted.filter((ui) =>
// filter out additions that do not start within the bounds of the timeline entry
const matchingAdditions = additionsList.filter((ui) =>
validUserInputForTimelineEntry(entry, nextEntry, ui, logsEnabled),
);

Expand Down

0 comments on commit cb1e45b

Please sign in to comment.