From 6f6f62295f0fbac7f020e56613f99f916c244cc4 Mon Sep 17 00:00:00 2001
From: Jean-Pascal <jean-pascal.aubry@inrae.fr>
Date: Mon, 18 Dec 2023 14:36:14 +0000
Subject: [PATCH] fix: remove FormulaireMacrorugo custom class Refs #609

---
 .../formulaire/definition/form-definition.ts  |  3 --
 .../definition/form-macrorugo-remous.ts       |  1 -
 .../formulaire/definition/form-macrorugo.ts   | 50 -------------------
 src/app/services/formulaire.service.ts        |  7 +--
 4 files changed, 1 insertion(+), 60 deletions(-)
 delete mode 100644 src/app/formulaire/definition/form-macrorugo.ts

diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts
index d5ebca4f2..3e4dfc160 100644
--- a/src/app/formulaire/definition/form-definition.ts
+++ b/src/app/formulaire/definition/form-definition.ts
@@ -478,18 +478,15 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
     //  interface Observer
 
     public update(sender: any, data: any) {
-        console.log("test")
         if (sender instanceof Nub) {
             switch (data.action) {
                 case "resultUpdated":
-                    console.log("test 1");
                     // forward Nub results update notification to FormCompute objects
                     this.reaffectResultComponents();
                     break;
             }
         }
         else if (sender instanceof SessionSettings) {
-            console.log("test 2");
             // reset results if a session setting (max iterations, compute precision) has bsseen modified
             this.reset();
         }
diff --git a/src/app/formulaire/definition/form-macrorugo-remous.ts b/src/app/formulaire/definition/form-macrorugo-remous.ts
index 5fdd1c8be..d8c53af79 100644
--- a/src/app/formulaire/definition/form-macrorugo-remous.ts
+++ b/src/app/formulaire/definition/form-macrorugo-remous.ts
@@ -41,7 +41,6 @@ export class FormulaireMacrorugoRemous extends FormulaireFixedVar {
     }
 
     protected reaffectResultComponents() {
-        console.log("reaffect");
         const mrr = this.currentNub as MacrorugoRemous;
         mrr.syncSectionMacroRugo();
         
diff --git a/src/app/formulaire/definition/form-macrorugo.ts b/src/app/formulaire/definition/form-macrorugo.ts
deleted file mode 100644
index 591a26310..000000000
--- a/src/app/formulaire/definition/form-macrorugo.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { RemousResults } from "app/results/remous-results";
-import { acSection, CourbeRemous, CourbeRemousParams, MacroRugo, MacrorugoRemous, Props, Result, Session } from "jalhyd";
-import { IObservable, MacrorugoRemousParams, Nub, Observer, Verificateur} from "jalhyd/build/internal_modules";
-import { FormulaireFixedVar } from "./form-fixedvar";
-import { SelectField } from "../elements/select/select-field";
-import { FallbackRegistry } from "@angular-devkit/core/src/experimental/jobs";
-import { FormulaireDefinition } from "./form-definition";
-import { FormulaireService } from "app/services/formulaire.service";
-import { ServiceFactory } from "app/services/service-factory";
-import { log } from "console";
-import { OnInit, DoCheck, AfterViewChecked, OnDestroy } from "@angular/core";
-
-export class FormulaireMacrorugo extends FormulaireFixedVar {
-
-
-    /** résultats de courbes de remous */
-
-    constructor() {
-        super();
-        this.updateCalcResults();
-    }
-    
-    protected updateCalcResults() {
-        console.log(console.log("vurrent", this._currentNub))
-        for (const n of Session.getInstance().getAllNubs()) {
-            if(n instanceof MacroRugo) {
-                console.log(n)
-            }
-            let pamRemous: MacrorugoRemous
-            if (n instanceof MacrorugoRemous) {
-                pamRemous = n;
-                console.log(pamRemous)
-                if (pamRemous !== undefined && this._currentNub !== undefined) {
-                    const form = ServiceFactory.formulaireService.getFormulaireFromNubId(pamRemous.uid);
-                    console.log(form)
-                    form.reset()
-                }     
-            }
-        }
-    }
-    protected reaffectResultComponents() {
-        // const ver: MacroRugo = (this.currentNub as MacroRugo);
-        this.updateCalcResults();
-    }
-
-    public resetFormResults() {
-        // this._verificateurResults.reset();
-        this.updateCalcResults();
-    }
-}
diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts
index 1eb8e7571..7e139665b 100644
--- a/src/app/services/formulaire.service.ts
+++ b/src/app/services/formulaire.service.ts
@@ -60,7 +60,7 @@ import { ServiceFactory } from "./service-factory";
 import { FormulairePressureLoss } from "app/formulaire/definition/form-pressureloss";
 import { getNubResultUnit } from "jalhyd";
 import { FormulaireMacrorugoRemous } from "app/formulaire/definition/form-macrorugo-remous";
-import { FormulaireMacrorugo } from "app/formulaire/definition/form-macrorugo";
+// import { FormulaireMacrorugo } from "app/formulaire/definition/form-macrorugo";
 
 @Injectable()
 export class FormulaireService extends Observable {
@@ -350,11 +350,6 @@ export class FormulaireService extends Observable {
                 f = new FormulaireMacrorugoRemous();
                 break;
 
-
-            case CalculatorType.MacroRugo:
-                f = new FormulaireMacrorugo();
-                break;
-
             default:
                 f = new FormulaireFixedVar();
         }
-- 
GitLab