More fixes

This commit is contained in:
Arunavo Ray
2025-07-18 00:52:03 +05:30
parent 251baeb1aa
commit 7bd862606b
7 changed files with 47 additions and 73 deletions

View File

@@ -66,30 +66,17 @@ export const GET: APIRoute = async ({ request }) => {
baseConditions.push(eq(repositories.isStarred, false));
}
// Get total count with all user config filters applied
const totalConditions = [...baseConditions];
if (githubConfig.skipForks) {
totalConditions.push(eq(repositories.isForked, false));
}
if (!githubConfig.privateRepositories) {
totalConditions.push(eq(repositories.isPrivate, false));
}
// Get actual total count (without user config filters)
const [totalCount] = await db
.select({ count: count() })
.from(repositories)
.where(and(...totalConditions));
// Get public count
const publicConditions = [...baseConditions, eq(repositories.isPrivate, false)];
if (githubConfig.skipForks) {
publicConditions.push(eq(repositories.isForked, false));
}
.where(and(...baseConditions));
// Get public count (actual count, not filtered)
const [publicCount] = await db
.select({ count: count() })
.from(repositories)
.where(and(...publicConditions));
.where(and(...baseConditions, eq(repositories.isPrivate, false)));
// Get private count (always show actual count regardless of config)
const [privateCount] = await db