Skip to content

Commit

Permalink
ORへらし
Browse files Browse the repository at this point in the history
  • Loading branch information
yukukotani committed Sep 12, 2020
1 parent 47c1244 commit fadb9b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions isuumo/webapp/nodejs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,12 @@ app.get("/api/recommended_estate/:id", async (req, res, next) => {
const query = promisify(connection.query.bind(connection));
try {
const [chair] = await query("SELECT * FROM chair WHERE id = ?", [id]);
const w = chair.width;
const h = chair.height;
const d = chair.depth;
const edges = [chair.width, chair.height, chair.depth].sort((a, b) => b - a);
const w = edges[1]
const h = edges[2]
const es = await query(
"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 ?",
[w, h, w, d, h, w, h, d, d, w, d, h, LIMIT]
"SELECT * FROM estate where (door_width >= ? AND door_height>= ?) OR (door_width >= ? AND door_height>= ?) ORDER BY popularity DESC, id ASC LIMIT ?",
[w, h, h, w, LIMIT]
);
const estates = es.map((estate) => camelcaseKeys(estate));
res.json({ estates });
Expand Down

0 comments on commit fadb9b1

Please sign in to comment.