Skip to content

Commit fadb9b1

Browse files
committed
ORへらし
1 parent 47c1244 commit fadb9b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

isuumo/webapp/nodejs/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,12 @@ app.get("/api/recommended_estate/:id", async (req, res, next) => {
561561
const query = promisify(connection.query.bind(connection));
562562
try {
563563
const [chair] = await query("SELECT * FROM chair WHERE id = ?", [id]);
564-
const w = chair.width;
565-
const h = chair.height;
566-
const d = chair.depth;
564+
const edges = [chair.width, chair.height, chair.depth].sort((a, b) => b - a);
565+
const w = edges[1]
566+
const h = edges[2]
567567
const es = await query(
568-
"SELECT * FROM estate where (door_width >= ? AND door_height>= ?) OR (door_width >= ? AND door_height>= ?) OR (door_width >= ? AND door_height>=?) OR (door_width >= ? AND door_height>=?) OR (door_width >= ? AND door_height>=?) OR (door_width >= ? AND door_height>=?) ORDER BY popularity DESC, id ASC LIMIT ?",
569-
[w, h, w, d, h, w, h, d, d, w, d, h, LIMIT]
568+
"SELECT * FROM estate where (door_width >= ? AND door_height>= ?) OR (door_width >= ? AND door_height>= ?) ORDER BY popularity DESC, id ASC LIMIT ?",
569+
[w, h, h, w, LIMIT]
570570
);
571571
const estates = es.map((estate) => camelcaseKeys(estate));
572572
res.json({ estates });

0 commit comments

Comments
 (0)