-
Notifications
You must be signed in to change notification settings - Fork 16
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
3007: Fix feeback rating for no search results as negative #3036
base: main
Are you sure you want to change the base?
3007: Fix feeback rating for no search results as negative #3036
Conversation
e4e5289
to
6d6e949
Compare
6d6e949
to
cfdbd3e
Compare
@@ -11,7 +11,7 @@ type FeedbackModalContainerProps = { | |||
} | |||
|
|||
const FeedbackModalContainer = ({ route }: FeedbackModalContainerProps): ReactElement => ( | |||
<FeedbackContainer {...route.params} /> | |||
<FeedbackContainer {...route.params} noResults={false} /> |
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.
noResults is optional you can just add noResults = false
at the FeedbackContainer props and remove this..
<FeedbackContainer {...route.params} noResults={false} /> | |
<FeedbackContainer {...route.params} /> |
@@ -33,7 +41,10 @@ const FeedbackContainer = ({ query, language, routeType, cityCode, slug }: Feedb | |||
|
|||
useEffect(() => { | |||
setSearchTerm(query) | |||
}, [query]) | |||
if (noResults === 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.
if (noResults === true) { | |
if (noResults) { |
it's already a boolean
@@ -28,11 +28,12 @@ describe('FeedbackContainer', () => { | |||
|
|||
const city = 'augsburg' | |||
const language = 'de' | |||
const noResults = false |
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 long you add the default value false for noResults this is not needed
const noResults = false |
|
||
it('should send feedback request with rating and no other inputs on submit', async () => { | ||
const { getByText, findByText } = render( | ||
<NavigationContainer> | ||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> | ||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> |
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.
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> | |
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> |
@@ -70,7 +71,7 @@ describe('FeedbackContainer', () => { | |||
const contactMail = '[email protected]' | |||
const { getByText, findByText, getAllByDisplayValue } = render( | |||
<NavigationContainer> | |||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> | |||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> |
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.
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> | |
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> |
@@ -106,7 +107,7 @@ describe('FeedbackContainer', () => { | |||
it('should disable send feedback button if rating button is clicked twice', async () => { | |||
const { getByText, findByText } = render( | |||
<NavigationContainer> | |||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> | |||
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> |
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.
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} noResults={noResults} /> | |
<FeedbackContainer routeType={CATEGORIES_ROUTE} language={language} cityCode={city} /> |
@@ -22,9 +22,17 @@ export type FeedbackContainerProps = { | |||
cityCode: string | |||
query?: string | |||
slug?: string | |||
noResults: boolean |
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.
noResults: boolean | |
noResults?: boolean |
I think there is noResults only when I search and 0 results so it's false most of the time until we set it to true.
routeType, | ||
cityCode, | ||
slug, | ||
noResults, |
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.
noResults, | |
noResults = false, |
language={language} | ||
cityCode={city} | ||
query={query} | ||
noResults={noResults} |
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.
noResults={noResults} |
language={language} | ||
cityCode={city} | ||
query={query} | ||
noResults={noResults} |
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.
noResults={noResults} |
language={language} | ||
cityCode={city} | ||
query='query' | ||
noResults={noResults} |
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.
noResults={noResults} |
@@ -56,7 +56,7 @@ export const FeedbackContainer = ({ | |||
query, | |||
slug, | |||
searchTerm, | |||
isPositiveRating, | |||
isPositiveRating: noResults === true ? false : isPositiveRating, |
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.
isPositiveRating: noResults === true ? false : isPositiveRating, | |
isPositiveRating: noResults ? false : isPositiveRating, |
Sorry about these comment should be in one review instead of 10 😅 |
Short description
The feedback for search requests with no results is currently being sent as neutral. The implemented solution ensures that feedback will automatically be marked as negative when no results are found.
Side effects
Resolved issues
Fixes: #3007