correctly handle selection of trunctated categories (#781)

This commit is contained in:
Bruce Martin
2019-05-23 08:46:22 -07:00
committed by GitHub
parent 49af278de7
commit ef7c26e799
5 changed files with 56 additions and 35 deletions
@@ -27,10 +27,10 @@ class Category extends React.Component {
const cat = categoricalSelection[metadataField];
const categoryCount = {
// total number of categories in this dimension
totalCatCount: cat.numCategories,
totalCatCount: cat.numCategoryValues,
// number of selected options in this category
selectedCatCount: _.reduce(
cat.categorySelected,
cat.categoryValueSelected,
(res, cond) => (cond ? res + 1 : res),
0
)
@@ -91,7 +91,7 @@ class Category extends React.Component {
const { categoricalSelection, metadataField } = this.props;
const cat = categoricalSelection[metadataField];
const optTuples = sortedCategoryValues([...cat.categoryIndices]);
const optTuples = sortedCategoryValues([...cat.categoryValueIndices]);
return _.map(optTuples, (tuple, i) => (
<Value
optTuples={optTuples}
+2 -2
View File
@@ -46,8 +46,8 @@ class CategoryValue extends React.Component {
if (!categoricalSelection) return null;
const category = categoricalSelection[metadataField];
const selected = category.categorySelected[categoryIndex];
const count = category.categoryCounts[categoryIndex];
const selected = category.categoryValueSelected[categoryIndex];
const count = category.categoryValueCounts[categoryIndex];
const value = category.categoryValues[categoryIndex];
const displayString = String(
category.categoryValues[categoryIndex]