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

Allow users to transfer matches between facilities #1464

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

TaiWilkin
Copy link
Contributor

@TaiWilkin TaiWilkin commented Sep 9, 2021

Overview

In some cases, list items have been incorrectly matched to a facility.
Currently, users will 'split' those list items away from the incorrect
facility. As a second step, they sometimes merge the match to a
different facility.

However, when the list items are not able to be geocoded, it's
impossible to use the 'split' functionality to create a new facility
from the match.

This adds the functionality to move or transfer a list item directly
from one existing facility to another existing facility, avoiding the
need to create a new, intermediate facility.

Connects #1459

Demo

Screen Shot 2021-09-09 at 2 41 58 PM

Screen Shot 2021-09-09 at 12 08 31 PM

Screen Shot 2021-09-09 at 12 08 43 PM

Screen Shot 2021-09-09 at 12 13 55 PM

Notes

Scott recommended using more descriptive / different titles for the buttons to clarify their purpose. I think to do this thoroughly will require a follow-up card to determine the most appropriate titles and do any refactoring / styling needed to improve the display.

Part of the facility details card was pulled out into a separate component. Initially I hope to reuse the entire component, but the card is actually the basis of the full page, and its functionality is very tied to the data flow for the facility whose matches are being adjusted. Separating the main UI of the card allowed me to reuse just that portion in the transfer modal with a different facility from the rest of the page.

Testing Instructions

  • Create a match by uploading two similar facility list items on separate lists.
  • Note the id of the facility (the source facility). Get the id of a different facility (the transfer facility) to which you will move the match.
  • Login as an admin and navigate to the adjust facility match dashboard.
  • Search for the source facility by id. It should display in the card as before.
  • The match you created should appear in the right hand. If it was successfully geocoded, it should show the 'split' button in addition to the 'promote' and 'transfer' buttons.
  • Click 'transfer'. A modal should open.
  • Search for the transfer facility by id and it should render in the modal.
  • Select 'cancel' and the modal should close. The transfer should not occur.
  • Reopen the modal and search again. Press 'transfer'. The modal should close and the match should be transferred.
  • Search for the transfer facility in the adjust facilities dashboard and you should see the match attached to it.
  • Use the history API to get the history of the source facility. The match move should be listed.

Checklist

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

Copy link
Contributor

@lederer lederer left a comment

Choose a reason for hiding this comment

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

UI for the dialog looks good.

The 3 buttons in the originating "Matches to adjust" panel are rather cramped, so I'm happy to see there'll be a follow-up card to work on that part of the UI.

Copy link
Contributor

@jwalgran jwalgran left a comment

Choose a reason for hiding this comment

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

Clear, easy to follow implementation. My test worked and I confirmed that in addition to the new MOVE event in the facility history of the secondary facility, the history of the target facility also includes an ASSOCIATE event for the new match. Nice work.

I did find was appears to be a bug in the new dialog box. Each keystoke into the text box sends an API request. We should fix this before merging.

2021-09-10 10 43 49

In some cases, list items have been incorrectly matched to a facility.
Currently, users will 'split' those list items away from the incorrect
facility. As a second step, they sometimes merge the match to a
different facility.

However, when the list items are not able to be geocoded, it's
impossible to use the 'split' functionality to create a new facility
from the match.

This adds the functionality to move or transfer a list item directly
from one existing facility to another existing facility, avoiding the
need to create an new, intermediate facility.
@TaiWilkin
Copy link
Contributor Author

@jwalgran I had to rebase in the process of fixing a weird build error that was occurring; apologies for muddying the water for changes.
In addition to the bug for the input, I found a second error where some matches with locations were not showing the split button. I'll comment inline to clarify where the change was made to correct this.

@@ -1793,6 +1796,8 @@ def split(self, request, pk=None):
m.facility_list_item.source.contributor.id
if m.facility_list_item.source.contributor else None,
'match_id': m.id,
'is_geocoded':
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that the geocoded location wasn't being passed through the API properly. Because we do not actually need to know the location on the front end, just whether it exists, I've updated to send a boolean instead of the geocoded point.

Copy link
Contributor

@jwalgran jwalgran left a comment

Choose a reason for hiding this comment

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

Retest successful. 👍

@jwalgran jwalgran removed their assignment Sep 13, 2021
@TaiWilkin
Copy link
Contributor Author

Thank you for reviewing!

@TaiWilkin TaiWilkin merged commit dcf853d into develop Sep 13, 2021
@TaiWilkin TaiWilkin deleted the tw/add-match-moving branch September 13, 2021 19:39
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.

3 participants