Remove filtering colors by prank column, now that we've deleted it

This commit is contained in:
Emi Matchu 2024-09-27 19:41:52 -07:00
parent 054dd484a5
commit 35479bf80e
2 changed files with 10 additions and 13 deletions

View file

@ -17,11 +17,8 @@ export async function getValidPetPoses() {
const largestColorIdPromise = getLargestColorId(db);
const distinctPetStatesPromise = getDistinctPetStates(db);
const [
largestSpeciesId,
largestColorId,
distinctPetStates,
] = await Promise.all([
const [largestSpeciesId, largestColorId, distinctPetStates] =
await Promise.all([
largestSpeciesIdPromise,
largestColorIdPromise,
distinctPetStatesPromise,
@ -90,7 +87,7 @@ async function getLargestSpeciesId(db) {
}
async function getLargestColorId(db) {
const [rows] = await db.query(`SELECT max(id) FROM colors WHERE prank = 0`);
const [rows] = await db.query(`SELECT max(id) FROM colors`);
return rows[0]["max(id)"];
}
@ -124,7 +121,7 @@ async function handle(req, res) {
async function handleWithBeeline(req, res) {
beeline.withTrace(
{ name: "api/validPetPoses", operation_name: "api/validPetPoses" },
() => handle(req, res)
() => handle(req, res),
);
}

View file

@ -60,7 +60,7 @@ const buildColorLoader = (db) => {
const colorLoader = new DataLoader(async (colorIds) => {
const qs = colorIds.map((_) => "?").join(",");
const [rows] = await db.execute(
`SELECT * FROM colors WHERE id IN (${qs}) AND prank = 0`,
`SELECT * FROM colors WHERE id IN (${qs})`,
colorIds,
);
@ -75,7 +75,7 @@ const buildColorLoader = (db) => {
});
colorLoader.loadAll = async () => {
const [rows] = await db.execute(`SELECT * FROM colors WHERE prank = 0`);
const [rows] = await db.execute(`SELECT * FROM colors`);
const entities = rows.map(normalizeRow);
for (const color of entities) {