Skip to content
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

Merged
merged 31 commits into from
Jan 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0366952
Add backend functions for sorting questions with the newest first
qinghaoyang Nov 13, 2022
412fca4
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Nov 13, 2022
5283c47
Fix lint errors
qinghaoyang Nov 13, 2022
45fc067
Completes the covereage test
qinghaoyang Nov 13, 2022
449dc4b
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Nov 29, 2022
748de42
Fix mypy errors
qinghaoyang Nov 29, 2022
9f470bb
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Dec 4, 2022
581281c
Change backend functions
qinghaoyang Dec 6, 2022
baa32ff
Change frontend functions
qinghaoyang Dec 6, 2022
8370912
Fix lint errors
qinghaoyang Dec 6, 2022
c33e9d3
Fix mypy errors
qinghaoyang Dec 6, 2022
304673a
Fix arguments error
qinghaoyang Dec 6, 2022
5734746
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Dec 22, 2022
75bc4d8
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Dec 29, 2022
6c2bfdd
Use positional args
qinghaoyang Dec 29, 2022
807fdc8
Use Date as the default choice
qinghaoyang Dec 29, 2022
e04ce60
Fix backend errors
qinghaoyang Dec 29, 2022
8cc15ce
Add a constant in constants.ts
qinghaoyang Dec 29, 2022
19371f4
Fetch a batch of items one time
qinghaoyang Dec 30, 2022
44c8d20
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Dec 30, 2022
0959288
Fix mypy errors
qinghaoyang Dec 30, 2022
b7848b1
Update frontend test
qinghaoyang Dec 30, 2022
91f889c
Fixed frontend bugs
qinghaoyang Dec 31, 2022
39de584
Set sort_key as a mandatory argument
qinghaoyang Jan 9, 2023
c3fc3b4
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Jan 9, 2023
3f3e83e
Update frontend tests
qinghaoyang Jan 9, 2023
766a329
Change the default sort key of reviewable translations to date
qinghaoyang Jan 10, 2023
8d9849a
Fix a bug about calculating offset
qinghaoyang Jan 10, 2023
4e80671
Fix mypy errors
qinghaoyang Jan 10, 2023
428f2ee
Add indexes
qinghaoyang Jan 10, 2023
a7cadb5
Merge remote-tracking branch 'upstream/develop' into sorting_questions
qinghaoyang Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix mypy errors
  • Loading branch information
qinghaoyang committed Dec 6, 2022
commit c33e9d387496623bab91e81f9c7ba52e2936d601
2 changes: 1 addition & 1 deletion core/storage/suggestion/gae_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def get_in_review_question_suggestions_by_offset(
sorted_results: List[GeneralSuggestionModel] = []

while len(sorted_results) < limit:
suggestion_model: GeneralSuggestionModel = (
suggestion_model: Sequence[GeneralSuggestionModel] = (
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a list of models, so the name is misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I changed it to suggestion_models

suggestion_query.fetch(1, offset=offset))
Copy link
Member

Choose a reason for hiding this comment

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

Fetching one by one will take a very long time. Why not fetch in larger batches (say 1000), go through the results, and filter manually as needed?

Please test this locally with 10000 items, try to make it so that the difference between 10k items and 1 item is not high (you can achieve this by doing a single fetch call rather than many).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good suggestion.

I tested the new codes locally. The execution time of the function get_in_review_question_suggestions_by_offset() is around 0.03s for 10k items, and around 0.002s for 1 item.

if not suggestion_model:
break
Expand Down