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

[#11302] Increase search result limit with message prompt when limit is reached #11324

Merged
merged 21 commits into from
Nov 4, 2021

Conversation

tjtanjin
Copy link
Contributor

@tjtanjin tjtanjin commented Aug 2, 2021

Fixes #11302

Outline of Solution

  • Raise the current search result limit from 20 to 50.
  • Should 50 results be returned and shown to the user, an additional message is shown to inform the user that there may be more results with a suggestion to search with more specific terms.

An example of how it would look like for a testing limit of 2 (instead of 50) is shown below for the admin search (the same behaviour is implemented for instructor search):

Screenshot 2021-08-02 at 7 32 17 PM

@damithc
Copy link
Contributor

damithc commented Aug 2, 2021

I'm OK with the proposed UX

@tjtanjin
Copy link
Contributor Author

tjtanjin commented Aug 2, 2021

Hello! Is anyone able to advice on the updating of snapshot tests?

I've followed the official jest documentation and tried the following 2 commands:

  • yarn jest --updateSnapshot
  • ./node_modules/.bin/jest --updateSnapshot

Both commands however produce an error of the following form for all 249 test cases (all failed to run):

  • SyntaxError: /path/to/teammates/jest-setup.ts: Unexpected token, expected "," (4:8)

Thus far, I have tried updating package.json and jest.config.js as suggested here. However, this did not resolve the issue. Any help/pointers would be greatly appreciated!

@damithc
Copy link
Contributor

damithc commented Aug 3, 2021

@TEAMMATES/active-mentors any help?

@samuelfangjw
Copy link
Member

samuelfangjw commented Aug 3, 2021

Hello! Is anyone able to advice on the updating of snapshot tests?

I've followed the official jest documentation and tried the following 2 commands:

  • yarn jest --updateSnapshot
  • ./node_modules/.bin/jest --updateSnapshot

Both commands however produce an error of the following form for all 249 test cases (all failed to run):

  • SyntaxError: /path/to/teammates/jest-setup.ts: Unexpected token, expected "," (4:8)

Thus far, I have tried updating package.json and jest.config.js as suggested here. However, this did not resolve the issue. Any help/pointers would be greatly appreciated!

Hey @tjtanjin! I usually do npm run test and wait till I get to this screen (see screenshot) then follow the on screen instructions to update the snapshots (either u to update all or i to update interactively).

Screenshot 2021-08-03 at 4 43 34 PM

Hope this helps!

@tjtanjin
Copy link
Contributor Author

tjtanjin commented Aug 3, 2021

@samuelfangjw Your suggestion helped, thank you! :)

@jianhandev
Copy link
Contributor

jianhandev commented Aug 10, 2021

Hi @tjtanjin let us know once the PR is ready for review, thanks!

@tjtanjin
Copy link
Contributor Author

Hi @jianhandev the PR is ready for review!

@daongochieu2810
Copy link
Contributor

@tjtanjin seems like there are some merge conflicts,can you resolve them first? thanks

@ypinhsuan ypinhsuan added the s.ToReview The PR is waiting for review(s) label Aug 13, 2021
@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@t-cheepeng
Copy link
Contributor

@daongochieu2810 @jianhandev For your kind review. Thanks

Copy link
Contributor

@moziliar moziliar left a comment

Choose a reason for hiding this comment

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

Hi, just some clarification here

@daongochieu2810
Copy link
Contributor

@tjtanjin can you create more data so that the search will return 50 or more results? so that we know it works as intended

@tjtanjin
Copy link
Contributor Author

tjtanjin commented Aug 23, 2021

@tjtanjin can you create more data so that the search will return 50 or more results? so that we know it works as intended

Hi! Here's a video showing the search return for 50 or more results:

Screen.Recording.2021-08-23.at.9.08.55.PM.mov

Copy link
Contributor

@jianhandev jianhandev left a comment

Choose a reason for hiding this comment

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

LGTM

@jianhandev
Copy link
Contributor

Thanks @wkurniawan07 @rrtheonlyone for your inputs. @tjtanjin moving forward, perhaps you can:

  1. Find out how to propagate the constant in the BE to the FE (see ApiConst.java)
  2. In admin-search-page.component.ts, check if the number of student and instructor results are each greater than their individual limit of 50, and display a toast message respectively for each scenario, for example:

Both exceed:
Screenshot 2021-10-13 at 1 09 51 AM

Instructor results exceed:
Screenshot 2021-10-13 at 1 11 09 AM

Student results exceed:
Screenshot 2021-10-13 at 1 11 32 AM

@nusoss-bot
Copy link

Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@moziliar
Copy link
Contributor

@tjtanjin Hi, any updates for this PR?

@tjtanjin
Copy link
Contributor Author

@t-cheepeng @jianhandev @moziliar Apologies for the late update, I have committed changes based on given suggestions, kindly advice if the changes are appropriate. Thank you!

@tjtanjin
Copy link
Contributor Author

@wkurniawan07 Thank you for the suggestions, I have made the changes accordingly.

@t-cheepeng t-cheepeng added s.ToReview The PR is waiting for review(s) and removed s.Ongoing The PR is being worked on by the author(s) labels Nov 2, 2021
Copy link
Member

@wkurniawan07 wkurniawan07 left a comment

Choose a reason for hiding this comment

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

I'm ok to accept the PR as is, but I'll leave behind a suggestion

} else if (this.students.length >= ApiConst.SEARCH_QUERY_SIZE_LIMIT) {
this.statusMessageService.showWarningToast(`${ApiConst.SEARCH_QUERY_SIZE_LIMIT} student results
${searchResultsLimitReached}`);
}
Copy link
Member

Choose a reason for hiding this comment

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

Here's how I'm going to refactor this part:

const limit: number = ApiConst.SEARCH_QUERY_SIZE_LIMIT;
const limitsReached: string[] = [];
if (this.students.length >= limit) {
  limitsReached.push(`${limit} student results`);
}
if (this.instructors.length >= limit) {
  limitsReached.push(`${limit} instructor results`);
}
if (limitsReached.length) {
  this.statusMessageService.showWarningToast(`${limitsReached.join(' and ')} have been shown on this page
      but there may be more results not shown. Consider searching with more specific terms.`);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the code according to your suggestion, thank you!

Copy link
Contributor

@madanalogy madanalogy left a comment

Choose a reason for hiding this comment

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

Changes seem fine, all comments so far addressed

@madanalogy madanalogy added c.Bug Bug/defect report s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.ToReview The PR is waiting for review(s) labels Nov 4, 2021
@madanalogy madanalogy added this to the V8.3.0 milestone Nov 4, 2021
@madanalogy madanalogy merged commit edc10ac into TEAMMATES:master Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Bug Bug/defect report s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin search: increase the search result cap