Skip to content
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3bd6d94
fixed summation after long fight with git :!
LSKpr May 6, 2025
c6a79a2
sorting kinda works - some problems exist
LSKpr May 7, 2025
6ef0ac0
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course
LSKpr May 7, 2025
1d02b82
fixed search + filter interaction
LSKpr May 7, 2025
9e6da22
sorting is better now / Metallic Materials are the only issue
LSKpr May 7, 2025
ed3e93f
asc/desc have correct icon now
LSKpr May 7, 2025
b4a43a4
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 7, 2025
1973a40
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 7, 2025
1880408
added favicon
LSKpr May 8, 2025
2e799ef
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
43a430f
fixed the website name in index.html
LSKpr May 8, 2025
9e57a66
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
1e2ac77
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
7fafcfb
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
45b7ae2
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
a6fce52
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
e7f0385
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
811154c
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
8662574
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
fd86c41
ArrowLeft closes the CoursePopup
LSKpr May 8, 2025
c461366
popup variables moved to the model
LSKpr May 8, 2025
f5a14d6
popup variables moved to the model
LSKpr May 8, 2025
8358f73
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
d80e280
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 8, 2025
df37e10
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 9, 2025
d18cc83
bug fix
LSKpr May 9, 2025
47bdcfc
prefix matching is preffered in search function
LSKpr May 9, 2025
5413a01
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
LSKpr May 9, 2025
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
15 changes: 13 additions & 2 deletions my-app/src/presenters/SearchbarPresenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ const SearchbarPresenter = observer(({ model }) => {
model.setCurrentSearch(model.filteredCourses);
} else {
const fuse = new Fuse(model.filteredCourses, fuseOptions);
const results = fuse.search(query).map((r) => r.item);
model.setCurrentSearch(results);
const results = fuse.search(query);

const sortedResults = results.sort((a, b) => {
const aStartsWith = a.item.code.toLowerCase().startsWith(query.toLowerCase());
const bStartsWith = b.item.code.toLowerCase().startsWith(query.toLowerCase());

//sort by prefix match as a primary sorting
if (aStartsWith && !bStartsWith) return -1;
if (!aStartsWith && bStartsWith) return 1;
return a.score - b.score; //Fuse.js score sorting otherwise
});

model.setCurrentSearch(sortedResults.map(r => r.item));
}
}, 500), []);

Expand Down