Fix metric explorer metric and dimension display bug. #1046
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.
The metric explorer uses a renderer to convert the internal ids to
the human readable values for many of the combo boxes. The lookup
function was incorrectly using the store.find() call which only
performs a substring match. In the observed case the defined metrics
were:
job_count_bad => 'Number of Inefficient Jobs'
job_count => 'Number of Jobs'
so when the code looked up the text for the job_count metric
the find() function would match the job_count_bad string
and the wrong text would be displayed.
This bug has been in the system forever. Why have we not noticed
it before. Well the backend code sorts the data
so that the human readable strings appear in alphabetical order. So
for example the resource / resource_type group by ends up sorted in the
following order:
resource => 'Resource'
resource_type => 'Resource Type'
therefore resource appears in the list first and a substring lookup
for resource returns the expected value. So, by luck most of the
cases do not happen. The only one I found is the SUPREMM Requested Wall
Hours Per Job and Requested Wall Hours: Total.
An even more curious reader might ask why updates to the JobEfficiency
realm would impact the job data. Well the code in the metric explorer
ignores the realm when building the list of statistics. So if two
different realms have the same metric then the text description for the
first one wins. In this case JobEfficiency is before Jobs in the
alphabet.
Before:
![image](https://user-images.githubusercontent.com/5342179/65044930-de6cbc80-d92b-11e9-9a35-deefd11ebed3.png)
After:
![image](https://user-images.githubusercontent.com/5342179/65045000-ff351200-d92b-11e9-8e70-5eb540509a18.png)