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

Conditionally change split operation to revert #1386

Merged
merged 1 commit into from Jun 10, 2021

Conversation

jwalgran
Copy link
Contributor

@jwalgran jwalgran commented Jun 9, 2021

Overview

Conditionally change the split operation on the dashboard to revert in cases when the list item was previously used to create a new facility.

Connects https://github.com/open-apparel-registry/open-apparel-registry-clients/issues/26

Demo

Screen Shot 2021-06-09 at 7 12 44 AM

Notes

In production we encountered a situation where a list item was used to create a facility but then through some sequence of moderation activities was matched to a different facility. Attempts to use split function in the dashboard failed because attempting to create a new facility from the list item violated the uniqueness constraint on Facility.created_from.

To work around this problem we now include facility_created_by_item in the data used to populate the dashboard split tool and conditionally offer a "revert" option in place of split and mirror that change in the API view to connect the match to the originally created facility rather than attempting to make a new facility record.## Testing Instructions

Testing

These instructions assume that you have run ./scripts/resetdb

m = FacilityMatch.objects.get(id={{the match ID}})
f = Facility()
f.country_code = m.facility_list_item.country_code
f.name = m.facility_list_item.name
f.address = m.facility_list_item.address
f.created_from = m.facility_list_item
f.location = m.facility_list_item.geocoded_point
f.save()
f.id
  • Note the OAR id printed after the last command and save it for later
  • On http://localhost:6543/dashboard/adjustfacilitymatches search for the OAR ID again and verify that the "SPLIT" button is now labeled "REVERT"
  • Click "REVERT" and verify that the confirmation modal has a title that includes the OAR ID. Verify that it is the same OAR ID as the facility created through shell_plus.
  • Confirm the revert and verify that it completes successfully.

Checklist

  • fixup! commits have been squashed
  • CI passes after rebase
  • CHANGELOG.md updated with summary of features or fixes, following Keep a Changelog guidelines

@jwalgran jwalgran changed the title DRAFT Conditionally change split operation to revert Conditionally change split operation to revert Jun 9, 2021
@jwalgran jwalgran requested a review from TaiWilkin June 9, 2021 20:49
@jwalgran jwalgran marked this pull request as ready for review June 9, 2021 20:50
Copy link
Contributor

@TaiWilkin TaiWilkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well!

@TaiWilkin TaiWilkin assigned jwalgran and unassigned TaiWilkin Jun 10, 2021
In production we encountered a situation where a list item was used to create a
facility but then through some sequence of moderation activities was matched to
a different facility. Attempts to use split function in the dashboard failed
because attempting to create a new facility from the list item violated the
uniqueness constraint on `Facility.created_from`.

To work around this problem we now include `facility_created_by_item` in the
data used to populate the dashboard split tool and conditionally offer a
"revert" option in place of split and mirror that change in the API view to
connect the match to the originally created facility rather than attempting to
make a new facility record.
@jwalgran
Copy link
Contributor Author

Thanks for the review.

@jwalgran jwalgran merged commit b220433 into develop Jun 10, 2021
@jwalgran jwalgran deleted the feature/jcw/revert-match branch June 10, 2021 16:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants