Actions
Issue #4604
closedRemove duplicates does not work properly if there are multiple repeated content types in the repo
Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 51
Quarter:
Description
It got manifested in docker plugin.
Snippet code:
async def run(self):
"""
The coroutine for this stage.
Returns:
The coroutine for this stage.
"""
async for batch in self.batches():
rm_q = Q()
for d_content in batch:
if isinstance(d_content.content, self.model):
unit_q_dict = {
field: getattr(d_content.content, field) for field in self.field_names
}
# Don't remove *this* object if it is already in the repository version.
not_this = ~Q(pk=d_content.content.pk)
dupe = Q(**unit_q_dict)
rm_q |= Q(dupe & not_this)
queryset_to_unassociate = self.model.objects.filter(rm_q)
self.new_version.remove_content(queryset_to_unassociate)
for d_content in batch:
await self.put(d_content)
When we process declarative_content.content in the batch that is different from the model we are supposed to remove the dupes, we end up to have rm_q empty which leads to removal of whole content of the model.
Files
Actions