From 86f9c37b30b74e1b2e12b755afdba08d6a68835f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 2 Dec 2022 21:20:37 +0100 Subject: [PATCH] =?UTF-8?q?Liste=20des=20milieux=20par=20d=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/environnement.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/module/environnement.js b/module/environnement.js index 9130cd39..b26c9747 100644 --- a/module/environnement.js +++ b/module/environnement.js @@ -8,17 +8,16 @@ const RARETES = [ { name: 'Frequente', frequence: 18, min: 9, max: 36 }, { name: 'Rare', frequence: 6, min: 3, max: 12 }, { name: 'Rarissime', frequence: 2, min: 1, max: 4 }] +const DEFAULT_RARETE = 1; const SETTINGS_LISTE_MILIEUX = "liste-milieux"; const MILIEUX = [ "Collines", "Déserts", - "Désolations", "Forêts", - "Forêts Tropicales", "Marais", - "Milieux Aquatiques", - "Milieux Maritimes", + "Cours d'eau", + "Maritimes", "Montagnes", "Plaines", "Sous-Sols", @@ -46,7 +45,7 @@ export class Environnement { } static getRarete(name = undefined) { - return RARETES.find(it => it.name == name) ?? RARETES[0]; + return RARETES.find(it => it.name == name) ?? RARETES[DEFAULT_RARETE]; } static getFrequenceRarete(rarete, field = undefined) { @@ -67,7 +66,7 @@ export class Environnement { async findEnvironnementsLike(search) { const milieux = (await this.milieux()).filter(it => Grammar.includesLowerCaseNoAccent(it, search)); - if (milieux.length > 1){ + if (milieux.length > 1) { const milieuExact = milieux.find(it => Grammar.equalsInsensitive(it, search)); if (milieuExact) { return [milieuExact];