fix(art): widg no count special
This commit is contained in:
@@ -6,6 +6,7 @@ import AutoFitText from "@/components/fit";
|
|||||||
import { getArtifactConfig } from "@/lib/api";
|
import { getArtifactConfig } from "@/lib/api";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { submissions } from "@/lib/db/schema";
|
import { submissions } from "@/lib/db/schema";
|
||||||
|
import { isNotNull, sql } from "drizzle-orm";
|
||||||
|
|
||||||
const kanit = Kanit({
|
const kanit = Kanit({
|
||||||
variable: "--font-kanit",
|
variable: "--font-kanit",
|
||||||
@@ -15,7 +16,11 @@ const kanit = Kanit({
|
|||||||
|
|
||||||
export default async function ArtifactCountWidget() {
|
export default async function ArtifactCountWidget() {
|
||||||
const config = await getArtifactConfig();
|
const config = await getArtifactConfig();
|
||||||
const count = await db.$count(submissions);
|
const count = await db
|
||||||
|
.select({ a: sql`NULL` })
|
||||||
|
.from(submissions)
|
||||||
|
.where(isNotNull(submissions.queue))
|
||||||
|
.then((e) => e.length);
|
||||||
|
|
||||||
const display = `${count} / ${config.limit < 0 ? "∞" : config.limit}`;
|
const display = `${count} / ${config.limit < 0 ? "∞" : config.limit}`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user