Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ZakirG
Copy link
Contributor

@ZakirG ZakirG commented Dec 20, 2019

deployed in https://zakir.planx-pla.net/explorer

demonstration of case 1 (unchecked zero):

  • check QA-test under project filters. note that many options that become zero disappear

demonstration of case 2 (checked zero):

  • under race, check all three options
  • check QA-test; note the greyed out zeroes that remain are checked
  • uncheck the race options; note that the ones that were zero disappear
  • uncheck the project ID filter, they come back

Improvements

  • UX Improvement: In the data explorer, filter options with counts of zero that have been checked by the user will not disappear. Once those options are unchecked, they will disappear.

@lgtm-com
Copy link

lgtm-com bot commented Dec 20, 2019

This pull request introduces 1 alert when merging 6ca5f08 into 29a968f - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@qingyashu
Copy link
Contributor

It seems this PR will show zeroes for all options, but I think our logic could be smarter: can we only show those zeroes for those selected options?

@lgtm-com
Copy link

lgtm-com bot commented Jan 28, 2020

This pull request introduces 1 alert when merging 0cffdf1 into 29a968f - view on LGTM.com

new alerts:

  • 1 for Implicit operand conversion

@lgtm-com
Copy link

lgtm-com bot commented Jan 28, 2020

This pull request introduces 2 alerts when merging 32c8b36 into 29a968f - view on LGTM.com

new alerts:

  • 2 for Implicit operand conversion

@lgtm-com
Copy link

lgtm-com bot commented Jan 29, 2020

This pull request introduces 2 alerts when merging 61c8516 into 29a968f - view on LGTM.com

new alerts:

  • 2 for Implicit operand conversion

export const updateCountsInInitialTabsOptions = (
initialTabsOptions, processedTabsOptions, filtersApplied,
) => {
const updatedTabsOptions = JSON.parse(JSON.stringify(initialTabsOptions));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to stringify and then parse this object here? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright it took me time to understand this code block but I guess you were trying to deep clone an object here. :D

filterConfig={this.props.filterConfig}
onFilterChange={e => this.handleFilterChange(e)}
hideZero={this.props.hideZero}
hideZero={this.props.hideZeroCountFilterOptions}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the reason why we change the name hideZero to hideZeroCountFilterOptions because of backward compatibility here?

receivedAggsData: {},
accessibility: ENUM_ACCESSIBILITY.ALL,
adminAppliedPreFilters: Object.assign({}, this.props.adminAppliedPreFilters),
filter: Object.assign({}, this.props.adminAppliedPreFilters),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems this this.state.filter is not useful anymore, could we just remove this, and so that not having both filter and filtersApplied, you might also want to remove its only reference in componentDidMount function

if (isFilterOptionToBeHidden(
updatedTabsOptions[fieldName].histogram[k], filtersApplied, fieldName,
)) {
updatedTabsOptions[fieldName].histogram.splice(k, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow I finally understand this 3-level loop 👍 I think this works! except the readability, and if there's a way to use JS's built -in Array filter or map function to reduce the level of nested loops that would be great. But anyway I am fine with keeping this. Could you add a break here? I know this if statement should only satisfy once in this for loop but just in case...

Copy link
Contributor

@qingyashu qingyashu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome and thanks for the fixing! Looks good to me so I just approved it. Is it possible that we deploy and test it somewhere?

Copy link
Contributor

@qingyashu qingyashu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry just checked the filterSelf feature doesn't work as before, going to hold this PR for a while for the fixing

@qingyashu
Copy link
Contributor

sorry about false alarm... the problem i mentioned is not a bug but a feature. Will approve this.

qingyashu
qingyashu previously approved these changes Feb 5, 2020
Copy link
Contributor

@qingyashu qingyashu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!~

@ZakirG ZakirG merged commit f970809 into master Feb 5, 2020
@ZakirG ZakirG deleted the fix/filters-disappearing-bug branch February 5, 2020 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants