Address #309, arrange variables in dropdown menu #310
Merged
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.
Currently, the order variables appear in the variable selection dropdown menu matches the order the first instance of each variable appears in the multimeta query. Historically, this has worked adequately for us, because we have added data in stages. We started with model output, then added climdex data, then degree day data, and finally return period data.
The multimeta query returns datasets in no particular order, but it approximates the order they were added to the database well enough, so historically variables have appeared in the menu with the related variables that were added at the same time. All the model outputs together, all the degree days together, etc.
Unfortunately, I just updated a bunch of data ( pacificclimate/climate-explorer-data-prep#73 ) and now the order modelmeta is returning data in is a lot less convenient and the default is a much more confusing menu. Many of the updated climdex variables now appear at the end of the variable dropdown, far separated from the rest of the climdex variables, and much harder to find (or look up in the help).
This PR orders the variables inside the variable selection dropdown. Variables are assigned into numerical "menu groups" via the new
menuGroup
attribute in the variable configuration file. The menu groups could be anything, but in this case, they're set to correspond to the groupings used in the data documentation:Variables not assigned to any group by the variable configuration file are assigned to group
MAX_SAFE_INTEGER
and appear at the end of the menu. With each group, variables are listed in alphabetical order.This is something of a temporary patch; long term variable selection is expected to work completely differently ( #216 ) . However, I think short term, making it easier to look up variables in the help file and find related variables is worth this quick fix.
Resolves #309