Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Handle the case when exact matching to a non matched items submitted with create=false #1580

Closed
jwalgran opened this issue Jan 14, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jwalgran
Copy link
Contributor

jwalgran commented Jan 14, 2022

Overview

If facility is submitted via API with create=false and there is no match a facility list item is created, but there is no facility match or facility. Subsequent submission of the same facility details will be an exact match to the item, but an exception is raised.

In this case, we should ignore the item instead and choose the next exact matching item or, if there are no other exact matches, proceed to the dedupe process.

Ensure that that if there is an automatic dedupe match, FacilityListItem.facility is set, allowing subsequent exact matches to avoid the exception.

"Traceback (most recent call last):
  File \"/usr/local/src/api/views.py\", line 1301, in create
    facility = Facility.objects.get(id=facility_id)
  File \"/usr/local/lib/python3.7/site-packages/django/db/models/manager.py\", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File \"/usr/local/lib/python3.7/site-packages/django/db/models/query.py\", line 408, in get
    self.model._meta.object_name
api.models.Facility.DoesNotExist: Facility matching query does not exist.
",

This is a fix to the original feature was added in #1568 where we implemented to address https://github.com/open-apparel-registry/open-apparel-registry-clients/issues/61

Steps to Reproduce

  • Browse /api/docs/#!/facilities/facilities_create authorize with an API token
  • Submit a facility with create=false twice. The second submission should result in ERROR_MATCHING
{
    "country": "Turkey",
    "name": "BAŞARI TEKSTİL",
    "address": "Merkezefendi"
}
@TaiWilkin TaiWilkin self-assigned this Jan 18, 2022
@obrienad obrienad changed the title Handle fhe case when exact matching to a non matvhed items submitted with create=false Handle fhe case when exact matching to a non matched items submitted with create=false Jan 21, 2022
@obrienad obrienad changed the title Handle fhe case when exact matching to a non matched items submitted with create=false Handle the case when exact matching to a non matched items submitted with create=false Jan 21, 2022
@TaiWilkin TaiWilkin added the bug Something isn't working label Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants