Hide empty values on the species page - #185
Open
eastagiletracker wants to merge 1 commit into
Open
Conversation
Conservation status rows, and the Facts About section, were rendered as N/A when the taxon had no value for them. Build the conservation status tables in the view instead, leaving out rows without a value, tables that would have no rows, and regions that have nothing to show.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes hiding the empty "N/A" rows on the species page so that only conservation statuses that actually have a value are displayed (Fixes #111). We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/276. You can sign in with your GitHub ID to claim ownership of the project.
What was wrong
Every species page rendered a fixed set of conservation status rows, filling in
N/Awherever the taxon had no value — thedefault_if_none:"N/A"filters on the global rank, US status, Canadian status, regional rank, regional status and wetland status cells ingoorchids/site/templates/gobotany/species.html. The "Facts About" section did the same for taxa with no factoid. This is visible on the site right now — the Ghost Orchid page renders five of them:A related detail: the region switcher was built from every
RegionalConservationStatusrow, so a region whose record carries no rank, status or wetland value still appeared in the drop-down and selected an all-N/Atable.The change
species_viewnow builds the conservation status tables it hands to the template (_conservation_status_tables), in the same spirit as the character-group structures it already assembles. A row is included only when it has a value, a table is included only when it has rows, and the region drop-down is built from the tables that survive, so a region with nothing to show is no longer offered. The template renders that structure instead of a fixed grid of cells. When a taxon has no conservation status at all, the section says so in one line rather than showing a table ofN/A. Rows that do have values keep their existing labels, order and markup — including thedata-regionattributes and thehiddenclass thatorchid_site/species.jstoggles — so the region switcher behaves exactly as before. The "Facts About" section is now omitted when the factoid is empty instead of printingN/A.Verifying it
Reproduced on
masteratf882c27with the new tests in place and the fix reverted:Six of the seven new tests fail on the unmodified tree; the seventh is the control that asserts a populated "Facts About" section still renders, and stays green either way. With the change applied they all pass, and the project suite goes from 3 tests to 10 with no new failures:
The tests live in
goorchids/site/tests/, following the package layout adopted forgoorchids/core/tests/in #183. They drive the real species URL through the test client and cover: ranks with no value dropped, regional statuses with no value dropped, a species with no status at all, a region that has nothing to show being left out of the switcher, every populated status still rendering (with the<option value="fl">Florida</option>markup intact), and the "Facts About" section in both states.How this was managed
This work was tracked as a story on a board imported from this repository's own issues and pull requests — 181 stories and 6 labels: Hide N/A values on the Species page, on the Go Orchids board.
If you'd rather not receive contributions like this, reply
no-more-prson this pull request and we won't open any further ones on your repositories.Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com