fix some event duplication in sequences

This commit is contained in:
tibbi 2018-12-03 15:44:33 +01:00
parent 9b4be2717e
commit 9258fd4ad2
1 changed files with 2 additions and 1 deletions

View File

@ -141,7 +141,8 @@ class IcsImporter(val activity: SimpleActivity) {
continue continue
} }
val eventToUpdate = existingEvents.firstOrNull { curImportId.isNotEmpty() && curImportId == it.importId } // repeating event exceptions can have the same import id as their parents, so pick the latest event to update
val eventToUpdate = existingEvents.filter { curImportId.isNotEmpty() && curImportId == it.importId }.sortedByDescending { it.lastUpdated }.firstOrNull()
if (eventToUpdate != null && eventToUpdate.lastUpdated >= curLastModified) { if (eventToUpdate != null && eventToUpdate.lastUpdated >= curLastModified) {
continue continue
} }