-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude (not set) city and country from reports. #9943
base: develop
Are you sure you want to change the base?
Conversation
Build files for 4e851a3 are ready:
|
Size Change: -4 B (0%) Total Size: 1.98 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ankitrox, this needs a revision, please see my comments.
@@ -79,15 +79,15 @@ const ANALYTICS_4_DIMENSION_OPTIONS = { | |||
'United States', | |||
'United Kingdom', | |||
'India', | |||
'(not set)', | |||
'Portugal', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change. We still want to mock the (not set)
value being returned in the mock report data, as we don't filter it out in all of our reports.
'Portugal', | |
'(not set)', |
'France', | ||
'Ukraine', | ||
'Italy', | ||
'Mexico', | ||
], | ||
city: [ | ||
'Dublin', | ||
'(not set)', | ||
'Mumbai', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above:
'Mumbai', | |
'(not set)', |
dimensionFilters: { | ||
city: { | ||
filterType: 'stringFilter', | ||
matchType: 'EXACT', | ||
value: '(not set)', | ||
notExpression: true, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct approach and doesn't follow the IB.
In fact, this filtering approach is what was specified in the original IB, and it won't meet the AC for the reasons discussed in #7884 (comment).
Please review the IB and amend the implementation appropriately.
dimensionFilters: { | ||
country: { | ||
filterType: 'stringFilter', | ||
matchType: 'EXACT', | ||
value: '(not set)', | ||
notExpression: true, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comment applies here as the one for the TopCitiesWidget
.
aa8171d
to
a4cdb3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ankitrox, that's working nicely. There's one more update needed, please see my comment.
const filteredCities = ( cityRows ) => | ||
cityRows.some( | ||
( { dimensionValues } ) => | ||
dimensionValues[ 0 ].value === '(not set)' | ||
) | ||
? cityRows.filter( | ||
( { dimensionValues } ) => | ||
dimensionValues[ 0 ].value !== '(not set)' | ||
) | ||
: cityRows.slice( 0, 3 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per this comment, #7884 (comment), we should create a reusable function for this logic, please can you lift this out as a common helper and reuse it in TopCountriesWidget
.
As well as making it generic, we can simplify it a bit, e.g.:
function reportRowsWithSetValues( rows, maxRows = 3 ) {
const rowsWithSetValues = rows.filter(
( { dimensionValues } ) =>
dimensionValues[ 0 ].value !== '(not set)'
);
return rowsWithSetValues.slice( 0, maxRows );
}
Thank you @techanvil . I have created a separated utility function so that we can use it in both places. Also added tests for the function. |
Summary
Addresses issue:
Relevant technical choices
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist