From 2f1938db3b3f9db83a14f3a1f1aaab2fcfe660d7 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Sat, 23 Nov 2024 20:41:48 -0700 Subject: [PATCH] Fixing bugs with default sort --- .../org/computate/frFR/java/EcrireApiClasse.java | 1 + .../org/computate/frFR/java/EcrirePageClasse.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java index 9a817f2..26f301f 100644 --- a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java @@ -4195,6 +4195,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { String classeTriSuffixeType = classeTrisSuffixeType.get(i); tl(4, i18nGlobale.getString(I18n.var_listeRecherche), ".sort(\"", classeTriVar, "_docvalues", classeTriSuffixeType, "\", \"", classeTriOrdre, "\");"); } + tl(4, i18nGlobale.getString(I18n.var_listeRecherche), ".setDefaultSort(true);"); } else { tl(4, i18nGlobale.getString(I18n.var_listeRecherche), ".sort(\"", classeVarCree, "_docvalues_date\", \"desc\");"); diff --git a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java index e5dcc5d..bd59ba4 100644 --- a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java @@ -1930,12 +1930,14 @@ public void pageCodeClasseJava(String langueNom, JsonObject langueConfig) throws if(classePageSuperNomSimple != null) tl(1, "@Override"); tl(1, "protected void _default", langueConfig.getString(I18n.var_Tri), "Vars(List l) {"); - tl(2, "Optional.ofNullable(", langueConfig.getString(I18n.var_listeRecherche), classeApiClasseNomSimple, "_.getSorts()).orElse(Arrays.asList()).forEach(var", langueConfig.getString(I18n.var_Tri), "Str -> {"); - tl(3, "String var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[] = var", langueConfig.getString(I18n.var_Tri), "Str.split(\" \");"); - tl(3, "String var", langueConfig.getString(I18n.var_Tri), " = ", classeNomSimple, ".", langueConfig.getString(I18n.var_recherche), "Var", classeNomSimple, "(var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[0]);"); - tl(3, "String var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Direction), " = var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[1];"); - tl(3, "l.add(String.format(\"%s %s\", var", langueConfig.getString(I18n.var_Tri), ", var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Direction), "));"); - tl(2, "});"); + tl(2, "if(!", langueConfig.getString(I18n.var_listeRecherche), classeApiClasseNomSimple, "_.getDefaultSort()) {"); + tl(3, "Optional.ofNullable(", langueConfig.getString(I18n.var_listeRecherche), classeApiClasseNomSimple, "_.getSorts()).orElse(Arrays.asList()).forEach(var", langueConfig.getString(I18n.var_Tri), "Str -> {"); + tl(4, "String var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[] = var", langueConfig.getString(I18n.var_Tri), "Str.split(\" \");"); + tl(4, "String var", langueConfig.getString(I18n.var_Tri), " = ", classeNomSimple, ".", langueConfig.getString(I18n.var_recherche), "Var", classeNomSimple, "(var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[0]);"); + tl(4, "String var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Direction), " = var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Parties), "[1];"); + tl(4, "l.add(String.format(\"%s %s\", var", langueConfig.getString(I18n.var_Tri), ", var", langueConfig.getString(I18n.var_Tri), langueConfig.getString(I18n.var_Direction), "));"); + tl(3, "});"); + tl(2, "}"); tl(1, "}"); l(); if(classePageSuperNomSimple != null)