Closed mo-nathan closed 4 days ago
@nimmolo Ran into some surprising behavior that I think is related to some Turbo magic happening on the FieldSlip show page. Currently on the website if you go to the FieldSlip show page for a field slip, any associated observation becomes that user's last ObservationView. This was not the original intention of that page since if you then click 'Edit Field Slip', the 'Switch to Last Observation' option shows the same thing as the 'Save with Current Observation' option which makes the switch option confusing and useless. In digging into why, it looks like the FieldSlip#show page is now indirectly calling the Observation#show page through Turbo which is where update_view_stats
is called which updates the ObservationView. I don't understand exactly why this is happening and the same behavior is not happening when you go to the FieldSlip#index page although it as well is display what are essentially the contents of the FieldSlip show page.
As a short term fix, I changed the "Last Observation" code in this PR to ensure that it doesn't return the exact same observation as the "Current Observation". While this is an improvement, it still doesn't really capture the intent of the feature. For example, if my intent is to connect Observation X with Field Slip Y and I go to Observation X, then go to the FieldSlip#index page and happen to click Field Slip Z, and then go back to the index and select Field Slip Y, then the "Last Observation" will be the observation associated with Field Slip Z, not Observation X.
TL;DR - I need a way for the FieldSlip show page to NOT have the side effect of calling update_view_stats
due to indirectly calling the Observation show page.
Joe Cohen
I created a Project (FSF Test) with no date constraints, Location: Earth, Field Slip prefix FSFTEST
OMS
) I created a field slip http://localhost:3000/qr/FSFTEST-00001
The Other Codes
field in the form could use a short explanation or example.
When a non-admin creates a field slip, it would be nice if the Collector field were pre-populated with the current user.
Some ideas for other PRs prior to NEMF:
(I think we may have discussed this already, but my memory is fading.) Questions:
FSPREFIX-천안시 봉서산
?FSPREFIX-000001
and FSPREFIX-1
? Seems confusing to me.Observation missing from Project.
- As
Joe Cohen
I created a Project (FSF Test) with no date constraints, Location: Earth, Field Slip prefixFSFTEST
As a non-admin (
OMS
) I created a field slip http://localhost:3000/qr/FSFTEST-00001
a random observation appeared (http://localhost:3000/observations/535653) and I ended up using it for the Field Slip. I forget exactly what I clicked to make this happen.
The Field Slip was created with that Observation. The Field Slip is included in the Field Slip index.
Issues:
The Observation is not associated with the Project
Not able to reproduce this. At first I figured it would have something to do with using the last observation, but that got associated with the project in question just fine (but it didn't complain about the constraint violations of that observation so that's a bit of a bug).
Form -- Other Codes
The
Other Codes
field in the form could use a short explanation or example.
Would something like " (e.g, iNat ID)" be enough?
When a non-admin creates a field slip, it would be nice if the Collector field were pre-populated with the current user.
I like this idea. Why just non-admins? I would expect admins would often be adding their own observations. Recorders generally wouldn't be, but they'd have to fill in the value anyway.
Some ideas for other PRs prior to NEMF:
- An easy way in the UX for Project Admins to navigate to the Field Slip index. (A simple solution is adding something to the lh nav menu.)
I don't think this make sense for the lh nav. I have been wondering about adding a field slips tab to the project page that would filter by that project. I think that might address a couple of your thoughts.
- FS Index: Each entry takes up too much space. It would be nice to have this as a table. And with very small thumbnails; something same size as a carousel image. (IMO the Images are way too big on this and many other pages. They push other content off the screen.)
I'll let you and @nimmolo arm wrestle on this one. I started with the thumbnail size ones and Nimmo objected. Just tell me what you guys decide. I have thought about switching the index to a table. Currently it's just using the show partial because that's what the rails generate scaffold does. What do you think of Thumbnail, Code, Collector, and ID? Should there be more columns? (I'm assuming it's scoped by project)
- FS Index: Should be searchable like other indexes, so that Recorder could display Field Slips for one Project.
Does this get handled if the index is always scoped by the project? There's an interesting question about Field Slips that aren't associated with a Project. Not clear that those really need an index page. There could be an unscoped version that lists everything and adds a "Project" column which could be blank.
- FS Index: Should be sortable.
Doesn't sound too hard. Is sorting by a single column sufficient?
- Clean up Users. Users with zero contribution who haven't accessed the site in a while (3 months) should be deleted as part of a chron job. That makes the User field type-ahead much more useful
That seems like a good idea which anyone could implement (hint, hint :-))!
- Name typeahead should hide or distinguish deprecated Names (e.g. by lighter font or "(deprecated)".
Can you give an example where this is really a problem? I would note that it is likely that recorders will be recording names that MO considers deprecated, but which the mycologists at the event still use.
Field Slip suffixes
(I think we may have discussed this already, but my memory is fading.) Questions:
- Should they be limited to numbers? If no, then limited to character set(s)? Ex.: Do you want to allow stuff like
FSPREFIX-천안시 봉서산
?- For numerical suffixes, do you want to allow both
FSPREFIX-000001
andFSPREFIX-1
? Seems confusing to me.
I don't see a strong reason to be strict about it. If you are using printed field slips then the suffix will always be 5 digit 0 padded numbers (unless they print values over 99999 which seems unlikely). If someone enters another value by hand, then the system accepts it. It seems like entering them by hand should be rare. All the field slips I've seen end in some sort of number, but that may not be universal. Also folks often seem to like to include a year and you could debate whether that is conceptually part of the prefix or the suffix.
If you guys want smaller images everywhere, you're probably going to need a different front-end guy! Foregrounding the images and prying them out of all the verbose cruft and "Craig's List HTML" framing in the views was my #1 goal in getting involved with Mushroom Observer and trying to lead us on this long march to the fabled promised land of Bootstrap 4.
To me scrolling is a small price to pay for a much more attractive layout, and not having to use "theater mode" to get a good look at an image. (But there's room for improvement...)
As to why i have the images bigger on create obs: if a user didn't notice a photo is blurry or otherwise not ideal before uploading, now is the time to catch it, as there is no "theater mode" on create obs. The image has to be big enough to evaluate quality-wise. Overall, the images section takes up less vertical room now than before, if there are more than two images on the obs. Tabbing/paging the form should help further - my goal is a form like the mobile app.
However, big images are of course not necessary in cases where the image is not what someone is looking for - like this field slip view.
One other thing i do care about moving towards, front-end-wise, though, is reusable components. They not only give a rhythm to the design and DRY up the code, but clue the user in to the type of info they contain. When someone is used to them, they can scan the page with much less eyestrain.
Sounds like what we need is a more compact "table-row"-like component for this and other admin-y views, so i say let's design and build one, so we can use it consistently. I had suggested the matrix-box here but i was only picturing a few obs. How many obs are there likely to be on this view? Dozens? Hundreds?
I do like the idea of the name autocompleter differentiating between MO-deprecated and approved names, without forcing the latter. I feel like this would make the naming form less of a gotcha for newbies.
Refactoring the autocompleters to return better data - JSON objects instead of strings, including the record IDs - is on my shortlist.
In my view the big images in most places make sense. I believe the issue is specifically around the FieldSlip index page. I'm fine with how things are on the FieldSlip show page, but I would also be fine with a smaller size more like what's on the observation index page. If the FieldSlip index page is going to get used regularly then I agree with Joe that we should have a more compact table-ish layout. I expect there will ultimately be 10s of 1000s of FieldSlips if they are widely adopted. A single NAMA foray often has in excess of 1000 collections. For NEMF we're planning on printing 4,800 field slips and I expect we'll actually use over 1000 in October. As a rough estimate, there are already more than 20,000 project observations with the largest project having over 2000 observation. Given that, even with filtering by project, the page is going to have to be paginated to load reasonably quickly. I expect we'll want each page to have something like 50 rows. Having some sort of thumbnail image of any associated observation make sense to me. Other than that, I don't have a lot of opinion about exactly how it looks.
I'll see if I can replicate this, paying more attention to what I'm doing.
Observation missing from Project.
- As
Joe Cohen
I created a Project (FSF Test) with no date constraints, Location: Earth, Field Slip prefixFSFTEST
As a non-admin (
OMS
) I created a field slip http://localhost:3000/qr/FSFTEST-00001
a random observation appeared (http://localhost:3000/observations/535653) and I ended up using it for the Field Slip. I forget exactly what I clicked to make this happen.
The Field Slip was created with that Observation. The Field Slip is included in the Field Slip index.
Issues:
The Observation is not associated with the Project
Not able to reproduce this. At first I figured it would have something to do with using the last observation, but that got associated with the project in question just fine (but it didn't complain about the constraint violations of that observation so that's a bit of a bug).
Yes; " (e.g, iNat ID)" would be great.
Form -- Other Codes
The
Other Codes
field in the form could use a short explanation or example.Would something like " (e.g, iNat ID)" be enough?
Makes sense.
Field Slip suffixes
(I think we may have discussed this already, but my memory is fading.) Questions:
- Should they be limited to numbers? If no, then limited to character set(s)? Ex.: Do you want to allow stuff like
FSPREFIX-천안시 봉서산
?- For numerical suffixes, do you want to allow both
FSPREFIX-000001
andFSPREFIX-1
? Seems confusing to me.I don't see a strong reason to be strict about it. If you are using printed field slips then the suffix will always be 5 digit 0 padded numbers (unless they print values over 99999 which seems unlikely). If someone enters another value by hand, then the system accepts it. It seems like entering them by hand should be rare. All the field slips I've seen end in some sort of number, but that may not be universal. Also folks often seem to like to include a year and you could debate whether that is conceptually part of the prefix or the suffix.
Added example text to "Other Codes" and made the default value for "Collector" smarter. Realized that if a field slip was created by a user and doesn't have a "Collector", then they are probably the better default than the current user. Now that there is a default, this should be a rare edge case, but seems worth getting right given that there are existing field slips out there.
I moved the discussion of improvements to the FieldSlip index page to it's own discussion, #2179. Other than @JoeCohen trying to replicate the Case of the Missing Project, I think this is ready to go.
I can reliably replicate the Case of the Missing Project.
http://localhost:3000/qr/FSFTEST-00010
into the address barI will poke around and see if I can make any progress.
Adding a FieldSlip to a Project does not automatically add (a) the Obs associated with the FieldSlip to (b) the Project. Is that intentional? (I didn't expect it.) If intentional, please ignore me. If unintentional: Suggestions:
update_observations_fields
proj = Project.find(params.dig(:field_slip, :project_ed))
proj.add_observation(@field_slip.observation)
And the same issue exists when creating a Field Slip and creating an Observation: The Field Slip gets added to the Project, but the Observation does not.
Joe and I talked it over and the root issue is that the project he was creating wasn't "open" so the user and the observation could not be added. In talking it over we decided that given that situation the field slip should also not be added. I also think that given the user a warning that this has happened would also make sense. Something like "The project associate with this field slip,
On this branch you can now add all the information requested by a field slip (except whether it has a photo or not) on the edit field slip page. The data will be stored and/or synched with the data in any associated observation. If no observation is currently associated with the field slip, then the field slip data will be added to the new observation. If a new observation is not created and you navigate away from the create observation page, then the new field slip data will be lost. Most of the field slip data gets stored as fields in the Notes section of the observation.
Currently there is separate date info associated with the field slip and the observation. Not sure that's right, but I don't know that it's a big deal and I can at least imagine situations where they could be different.
If a field slip id is added then the existing namings are checked and if that name has not been applied to any existing observation, then it gets applied with a default vote of "I'd Call It That". My goal with all of this is to make the "happy path" for recorders at events as straight forward as possible. There's still a bit of a rough edge in how someone at a computer should be scanning the QR codes. It's possible to use one of the online QR code readers, but it would be better if there was an option in the website, but I think that's work for another ticket.
In the process I also cleaned up the CRUD for field slips to bring them more in line with what we do elsewhere in the site.
Here are some specific scenarios I used while developing:
1) As a project admin, I would create a new field slip with a URL something like http://localhost:3000/qr/NFAL-00010. You’ll need to add yourself as an admin or login as me if you use the NFAL project. Fill out the form (play with the auto-completes including providing values that aren’t in MO) and click ‘Create New Observation’. Ensure that all the data gets saved and that you can edit the fields etc. Auto-complete values that match stuff in the database should get rendered as reasonable Textile.
2) As a non-admin create a new field slip with a similar URL and create a new observation, but don’t add much data (include no name or non-specific names). Then as an admin go to the same URL (should take you to the observation). Now click on the field slip on the right hand side. Fill in the data as though it were coming from a field slip, but now with a name from some mycologist. Ensure that the new data and name get applied correctly to the observation. Note that the naming will still come from you, but the Field Slip ID By field should show the mycologist’s name.