Skip to content

Commit

Permalink
fix: request more items to handle tensei/tenni duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowAgar25 committed Nov 22, 2024
1 parent f11e58a commit db34dc2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/routes/syosetu/ranking-isekai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function getIsekaiSearchParams(period, category, novelType, limit): SearchParams
const searchParams: SearchParams = {
order: periodToOrder[period],
gzip: 5,
lim: Math.ceil(limit / 2),
// Request 20% more items to compensate for potential duplicates between tensei/tenni
lim: Math.ceil((limit / 2) * 1.2),
};

if (novelType !== NovelType.TOTAL) {
Expand Down Expand Up @@ -86,7 +87,7 @@ export async function handleIsekaiRanking(type: string, limit: number): Promise<
return {
title: `小説家になろう - ${rankingTitle}`,
link: rankingUrl,
item: items as DataItem[],
item: items.slice(0, limit) as DataItem[],
language: 'ja',
};
}

0 comments on commit db34dc2

Please sign in to comment.