Remove filtering colors by prank column, now that we've deleted it
This commit is contained in:
parent
054dd484a5
commit
35479bf80e
2 changed files with 10 additions and 13 deletions
|
@ -17,15 +17,12 @@ export async function getValidPetPoses() {
|
||||||
const largestColorIdPromise = getLargestColorId(db);
|
const largestColorIdPromise = getLargestColorId(db);
|
||||||
const distinctPetStatesPromise = getDistinctPetStates(db);
|
const distinctPetStatesPromise = getDistinctPetStates(db);
|
||||||
|
|
||||||
const [
|
const [largestSpeciesId, largestColorId, distinctPetStates] =
|
||||||
largestSpeciesId,
|
await Promise.all([
|
||||||
largestColorId,
|
largestSpeciesIdPromise,
|
||||||
distinctPetStates,
|
largestColorIdPromise,
|
||||||
] = await Promise.all([
|
distinctPetStatesPromise,
|
||||||
largestSpeciesIdPromise,
|
]);
|
||||||
largestColorIdPromise,
|
|
||||||
distinctPetStatesPromise,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const poseStrs = new Set();
|
const poseStrs = new Set();
|
||||||
for (const petState of distinctPetStates) {
|
for (const petState of distinctPetStates) {
|
||||||
|
@ -90,7 +87,7 @@ async function getLargestSpeciesId(db) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getLargestColorId(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)"];
|
return rows[0]["max(id)"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +121,7 @@ async function handle(req, res) {
|
||||||
async function handleWithBeeline(req, res) {
|
async function handleWithBeeline(req, res) {
|
||||||
beeline.withTrace(
|
beeline.withTrace(
|
||||||
{ name: "api/validPetPoses", operation_name: "api/validPetPoses" },
|
{ name: "api/validPetPoses", operation_name: "api/validPetPoses" },
|
||||||
() => handle(req, res)
|
() => handle(req, res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ const buildColorLoader = (db) => {
|
||||||
const colorLoader = new DataLoader(async (colorIds) => {
|
const colorLoader = new DataLoader(async (colorIds) => {
|
||||||
const qs = colorIds.map((_) => "?").join(",");
|
const qs = colorIds.map((_) => "?").join(",");
|
||||||
const [rows] = await db.execute(
|
const [rows] = await db.execute(
|
||||||
`SELECT * FROM colors WHERE id IN (${qs}) AND prank = 0`,
|
`SELECT * FROM colors WHERE id IN (${qs})`,
|
||||||
colorIds,
|
colorIds,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ const buildColorLoader = (db) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
colorLoader.loadAll = async () => {
|
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);
|
const entities = rows.map(normalizeRow);
|
||||||
|
|
||||||
for (const color of entities) {
|
for (const color of entities) {
|
||||||
|
|
Loading…
Reference in a new issue