Skip to content

Commit

Permalink
fix(search): show externals as well when searching int
Browse files Browse the repository at this point in the history
  • Loading branch information
sunehs committed May 30, 2024
1 parent 8f2dece commit 57d8eab
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/api/levelpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ const getPacksByQuery = async query => {

const getLevelsByQuery = async (query, offset, showLocked, isMod) => {
const LevelName = formatLevelSearch(query);
let where = {
LevelName: {
[Op.like]: `${like(query)}%`,
},
};
if (LevelName !== query) {
where = {
LevelName: {
[Op.or]: [{ [Op.like]: `${like(query)}%` }, { [Op.eq]: LevelName }],
},
};
}
let show = false;
const q = {
attributes: [
Expand All @@ -585,13 +597,10 @@ const getLevelsByQuery = async (query, offset, showLocked, isMod) => {
'AddedBy',
],
offset: searchOffset(offset),
where: {
LevelName: {
[Op.like]: `${like(LevelName)}%`,
},
},
where,
limit: searchLimit(offset),
order: [
[sequelize.literal(`LevelName = ${sequelize.escape(LevelName)} DESC`)],
['LevelName', 'ASC'],
['LevelIndex', 'ASC'],
],
Expand Down

0 comments on commit 57d8eab

Please sign in to comment.