Skip to content

Commit

Permalink
fix: module query and graph function
Browse files Browse the repository at this point in the history
Co-authored-by: PsicoThePato <[email protected]>
  • Loading branch information
EdSDR and PsicoThePato committed Oct 17, 2024
1 parent 1f78351 commit 4b860b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/commune-validator/src/app/components/charts/_common.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { assert } from "tsafe";

const separateTopAndOther = <T>(
numTop: number,
compare: (a: T, b: T) => number,
reduceRest: (xs: T[]) => T,
xs: T[],
) => {
assert(xs.length >= numTop);
if (xs.length < numTop) {
return xs;
}
const sorted = xs.sort(compare);
const top = sorted.slice(0, numTop);
const rest = sorted.slice(numTop);
Expand Down
4 changes: 3 additions & 1 deletion packages/api/src/router/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { authenticatedProcedure, publicProcedure } from "../trpc";
export const moduleRouter = {
// GET
all: publicProcedure.query(({ ctx }) => {
return ctx.db.query.moduleData.findMany();
return ctx.db.query.moduleData.findMany({
where: eq(moduleData.isWhitelisted, true),
});
}),
byId: publicProcedure
.input(z.object({ id: z.number() }))
Expand Down

0 comments on commit 4b860b3

Please sign in to comment.