From e10c674838aab2fafe42277c9d28a34596d69be6 Mon Sep 17 00:00:00 2001 From: Eliott Collin <eliott.collin0307@gmail.com> Date: Tue, 25 Jan 2022 13:04:22 +0100 Subject: [PATCH] =?UTF-8?q?sort=20"Par=20prix=20petit=20format=20croissant?= =?UTF-8?q?=20et=20en=20cas=20d'=C3=A9galit=C3=A9,=20par=20prix=20grand=20?= =?UTF-8?q?format=20croissant"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index ca9cf4f..7e0ace2 100644 --- a/src/main.js +++ b/src/main.js @@ -23,7 +23,10 @@ const data = [ ]; data.sort((a, b) => { - return a.price_small - b.price_small; + //return (a.price_small == b.price_small)?a.price_large - b.price_large:a.price_small - b.price_small; + if (a.price_small === b.price_small) + return a.price_large - b.price_large + else return a.price_small - b.price_small; }); const html = data.reduce((previous, current) => { -- GitLab