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

Instructor Search #137

Merged
merged 16 commits into from
Mar 17, 2024
Merged

Instructor Search #137

merged 16 commits into from
Mar 17, 2024

Conversation

Xavilien
Copy link
Member

@Xavilien Xavilien commented Feb 18, 2024

Description

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

To test, set serializableCheck in store.ts:81 to false so that you don't get this error:
image

  • Search various professors
  • Scroll to different pages, then change the search query
  • Play around with the filters

Test Configuration:

  • Node.js version: 18.18.0
  • Desktop/Mobile: Desktop
  • OS: Mac Sonoma
  • Browser: Safari

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link

railway-app bot commented Feb 18, 2024

This PR was not deployed automatically as @Xavilien does not have access to the Railway project.

In order to get automatic PR deploys, please add @Xavilien to your team on Railway.

…gle professor entry by hiding loading for professors list but showing it for individual pages
@Xavilien Xavilien marked this pull request as ready for review February 18, 2024 02:52
@Xavilien Xavilien requested a review from Lhwhatever February 18, 2024 02:52
Copy link
Collaborator

@Lhwhatever Lhwhatever left a comment

Choose a reason for hiding this comment

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

see comment about Professors/Instructors

frontend/src/app/cache.ts Outdated Show resolved Hide resolved
frontend/src/components/SideNav.tsx Outdated Show resolved Hide resolved
@Xavilien
Copy link
Member Author

@Lhwhatever have made the refactoring from "professor" to "instructors". Have also used fuse.js for fuzzy searching. It's not perfect but it may be slightly better than the previous version. Also refactored some code so that searching is speedier so now it should be just as fast (if not faster) than the course search. Do let me know if there are any other comments!

@Lhwhatever Lhwhatever self-requested a review March 16, 2024 19:10
includeScore: true,
};

const fuse = new Fuse(state.allInstructors, options);
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure if this could be a global variable --- is this expensive to instantiate for every search?

@Xavilien Xavilien changed the title Professor Search Instructor Search Mar 16, 2024
@@ -45,6 +52,11 @@ const initialState: CacheState = {
coursesLoading: false,
exactResultsCourses: [],
allCourses: [],
allInstructors: [],
fuseIndex: null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

the type for fuseIndex seems not to be nullable here?

state.instructorsLoading = false;
if (action.payload) {
state.allInstructors = action.payload;
state.fuseIndex = Fuse.createIndex(["instructor"], action.payload).toJSON();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not too sure on the Fuse library API so I will trust this here

Copy link
Member Author

Choose a reason for hiding this comment

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

@Xavilien Xavilien merged commit 124ac0b into main Mar 17, 2024
1 check passed
@Xavilien Xavilien deleted the xavier/professor-search branch March 17, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants