-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix #16069: Add a "Newest First" tag for reviewable questions #16534
Conversation
Hi @qinghaoyang, can you complete the following:
|
Hi, @qinghaoyang, this pull request does not have a "CHANGELOG: ..." label as mentioned in the PR pointers. Assigning @qinghaoyang to add the required label. PRs without this label will not be merged. If you are unsure of which label to add, please ask the reviewers for guidance. Thanks! |
Hi @qinghaoyang, the build of this PR is stale and this could result in tests failing in develop. Please update this pull request with the latest changes from develop. Thanks! |
Hi @qinghaoyang. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks! |
Hi @qinghaoyang, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 4 days, it will be automatically closed so that others can take up the issue. |
Hi @qinghaoyang, there is a new change in develop which needs to be in your PR. Please update your branch with the latest changes in develop. For instructions, refer to this link. Thanks! |
Hi @qinghaoyang, there is a new change in develop which needs to be in your PR. Please update your branch with the latest changes in develop. For instructions, refer to this link. Thanks! |
Hi @qinghaoyang, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 4 days, it will be automatically closed so that others can take up the issue. |
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.
@seanlip PTAL.
core/feconf.py
Outdated
@@ -1638,6 +1638,9 @@ def get_empty_ratings() -> Dict[str, int]: | |||
SUGGESTION_TYPE_ADD_QUESTION | |||
] | |||
|
|||
# The sort keys of submitted questions shown on the Contributor Dashboard. | |||
QUESTIONS_SORT_KEYS = ['Default', 'Date'] |
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.
Deleted.
@@ -705,7 +705,7 @@ describe('Contributions and review component', () => { | |||
expect(component.activeExplorationId).toBeNull(); | |||
})); | |||
|
|||
it('should return true on Review Translations tab', fakeAsync(() => { | |||
it('should on Review Translations tab', fakeAsync(() => { |
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.
Done.
expect(alertsService.addSuccessMessage) | ||
.toHaveBeenCalledWith('Submitted suggestion review.'); | ||
})); | ||
|
||
it('should return false on Review Questions tab', () => { | ||
it('should on Review Questions tab', () => { |
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.
Done
@@ -515,6 +529,8 @@ export class ContributionsAndReview | |||
this.TAB_TYPE_CONTRIBUTIONS = 'contributions'; | |||
this.TAB_TYPE_REVIEWS = 'reviews'; | |||
this.TAB_TYPE_ACCOMPLISHMENTS = 'accomplishments'; | |||
this.QUESTIONS_SORT_KEYS = ['Date']; |
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.
Yes. Changed 'Date' to the constant in constants.ts.
@@ -74,7 +74,9 @@ describe('Contribution and review backend API service', () => { | |||
carbas.fetchSuggestionsAsync( | |||
'SUBMITTED_QUESTION_SUGGESTIONS', | |||
AppConstants.OPPORTUNITIES_PAGE_SIZE, | |||
0, 'All' | |||
0, | |||
undefined, |
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 for the suggestion. Updated.
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 @qinghaoyang! Replied, PTAL.
assets/constants.ts
Outdated
@@ -5857,7 +5857,8 @@ export default { | |||
"translation", "voiceover", "question", "submit_question" | |||
], | |||
|
|||
"QUESTIONS_SORT_KEY_DATE": "Date", | |||
"SUGGESTIONS_SORT_KEY_DATE": "Date", | |||
"SUGGESTIONS_SORT_KEY_NULL": "", |
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.
Can we not have this constant? This is because Null/None should be different from empty string -- we should actually pass null / None instead.
Also, if possible, I think we shouldn't allow a case where the output is unsorted anyway. If we always require a sort order, it would make things simpler.
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.
I removed this line.
return this.fetchSuggestionsAsync( | ||
this.userCreatedQuestionFetcher, | ||
shouldResetOffset); | ||
} | ||
|
||
async getReviewableQuestionSuggestionsAsync( | ||
shouldResetOffset: boolean = true, | ||
sortKey?: string | ||
sortKey: string = '' |
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 should be null
if you don't actually have a sort key, rather than ''
.
(Better to always have a sort key though, if possible.)
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.
I removed ''
@@ -768,18 +768,16 @@ describe('Contributions and review component', () => { | |||
tick(); | |||
|
|||
expect(component.isReviewTranslationsTab()).toBeTrue(); | |||
expect(component.isReviewQuestionsTab()).toBeFalse(); |
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.
I think you can probably keep this assertion, it does no harm and is a reasonable check to make sure the calls are working correctly.
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.
Done.
spyOn(component, 'openQuestionSuggestionModal').and.callFake(() => { | ||
return; | ||
}); | ||
|
||
component.switchToTab(component.TAB_TYPE_REVIEWS, 'add_question'); | ||
expect(component.isReviewTranslationsTab()).toBeFalse(); |
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.
Ditto.
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.
Done.
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.
@seanlip PTAL. Currently, the reviewable translations in the backend are not sorted. I added a feature to sort them by date, as I did for reviewable questions. Also, I added a video to show that the reviewable translations are sorted by date by default.
@@ -768,18 +768,16 @@ describe('Contributions and review component', () => { | |||
tick(); | |||
|
|||
expect(component.isReviewTranslationsTab()).toBeTrue(); | |||
expect(component.isReviewQuestionsTab()).toBeFalse(); |
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.
Done.
spyOn(component, 'openQuestionSuggestionModal').and.callFake(() => { | ||
return; | ||
}); | ||
|
||
component.switchToTab(component.TAB_TYPE_REVIEWS, 'add_question'); | ||
expect(component.isReviewTranslationsTab()).toBeFalse(); |
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.
Done.
assets/constants.ts
Outdated
@@ -5857,7 +5857,8 @@ export default { | |||
"translation", "voiceover", "question", "submit_question" | |||
], | |||
|
|||
"QUESTIONS_SORT_KEY_DATE": "Date", | |||
"SUGGESTIONS_SORT_KEY_DATE": "Date", | |||
"SUGGESTIONS_SORT_KEY_NULL": "", |
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.
I removed this line.
return this.fetchSuggestionsAsync( | ||
this.userCreatedQuestionFetcher, | ||
shouldResetOffset); | ||
} | ||
|
||
async getReviewableQuestionSuggestionsAsync( | ||
shouldResetOffset: boolean = true, | ||
sortKey?: string | ||
sortKey: string = '' |
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.
I removed ''
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 @qinghaoyang! I think this looks great.
Just one question, can you check index.yaml to see if it has the right indexes to support the necessary queries? If not we'll need to add them, otherwise this will throw an error in production when we deploy it.
Also -- @vojtechjelinek I believe index.yaml used to autogenerate indexes, but I think it doesn't do that any more. Is that correct?
@seanlip PTAL. |
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 @qinghaoyang! LGTM!
Hi @qinghaoyang, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
Overview
Essential Checklist
Proof that changes are correct
Screen.Recording.2022-12-29.at.8.14.44.PM.mov
The change does not create issues when clicking other tabs.
Screen.Recording.2023-01-08.at.5.08.52.PM.mov
PR Pointers