-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observations::LocationsController
, not Locations::MergesController
#1920
Conversation
Combines two controllers I created without really understanding what they did: `Locations::MergesController` (a GET form action) and `Locations::ObservationsController` (a PUT/PATCH callback for the same form) into one controller. The form gives a UI to deal with “Observations that have a `where` but no `Location`". In other words, they just have a string a user entered, that maybe matches one or more of our Locations. So it’s not a merge, properly speaking. It’s a bulk assignment of a Location association, where there was no association before. It seems to belong more properly under "Observations". Clears up confusion from my misleadingly-named `Locations::MergesController`: this form does not merge Location records.
@JoeCohen For review, I'd just like to ask for you to give it a front-end try-out, to be sure that this works exactly as previously. Not having used it before, I don't know! The link to this form appears on the index for "Observations at where", which i believe should show all observations with a given "undefined" location (that is to say, no location, only a "where"). |
@JoeCohen This is ready to go, but I won't merge it until you've certified it. |
The problem I ran into was after creating an undefined location |
@JoeCohen - this is very helpful.
|
For # 1, there's no form involved, and it works fine. So if you haven't
touched any relevant code you should probably just ignore it.
(If in admin mode, I edit location A, changing its name to be the same as
the name of location B, it merges A into B as soon as I click Update.)
…On Mon, Feb 19, 2024 at 11:33 AM andrew nimmo ***@***.***> wrote:
@JoeCohen <https://github.com/JoeCohen> - this is very helpful.
re:
1. I don't think i touched any code relating to *merging* two defined
locations, but i can try to write a test for it. I gather from what you're
saying that when you're *editing* a location in admin mode and you try
to edit a location that matches an existing location name, we return
location merge options to the form during validation. I'm guessing that
happens via form_location_feedback, but I haven't checked into it.
2. I noticed the same thing - using a string that should be similar to
existing locations, it didn't come up with any matching locations when I
tried this in dev mode. I don't think that's ok, that means something is
not working.
—
Reply to this email directly, view it on GitHub
<#1920 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALDFCXXTYK2IQFVJYGR73YUOSHVAVCNFSM6AAAAABDNZ4XF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTGA3DEMJVHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@JoeCohen - for 2, on But the observation I just made with "State of Oregon" does not then have its location updated. So I don't think this is working on For now I'm going to try to debug it on this branch, rather than try to sort out main retroactively. |
@JoeCohen - Sorted out the bug in 2, which is also on I also noticed that this page can return an unmanageably long page of results.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything went smoothly with the new form.
Thanks for re-doing this, fixing the old bug, and adding the test.
Deployed |
This PR refactors two controllers I created without really understanding what they did:
Locations::MergesController
(containing only one "new" GET form action, and an unused "create" route) andLocations::ObservationsController
(containing only an "update" PUT/PATCH callback... for the other controller's "new" form!).It combines these two controllers into a new
Observations::LocationsController
, with anedit
andupdate
action, and adjusts routes accordingly. The routes are not used outside a couple places in the site.The
edit
form provides a UI to deal with Observations that have a givenwhere
attribute but noLocation
. In other words, these obs just have a "where" string a user entered, that maybe matches one or more of our Locations. Clicking a link in the form will associate all Observations that have the same "where" string with the matched Location.To be clear, this form does not (never did) deal with
Location
record merges, which can only be done manually by a web admin. It provides a bulk assignment of aLocation
association to all matching Observations, where there was no association before. It seems to belong more properly under "Observations", since it updates "Observation" records.