From 25201b54f5f5de97f5aaf193fd13e628a1b5f68a Mon Sep 17 00:00:00 2001
From: antoine37120 <ant.dupre@gmail.com>
Date: Wed, 29 Nov 2023 12:01:13 +0100
Subject: [PATCH] fix: change subscribeVirtual to tzcld profile from community
 to reduce globals component reload

---
 src/views-terrytories.js                           |  7 ++++---
 src/widjets-display-evaluation-indicators-tzcld.js | 12 ++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/views-terrytories.js b/src/views-terrytories.js
index 0cd06c1..2c77ccd 100644
--- a/src/views-terrytories.js
+++ b/src/views-terrytories.js
@@ -734,11 +734,12 @@ import("./utils.js").then((utils) => {
             </solid-widget>
                     
                     <h2 class="margin-none margin-bottom-medium sm-margin-none sm-margin-right-xsmall sm-margin-bottom-small sm-margin-left-xsmall text-color-heading text-bold text-xxxlarge text-letter-spacing-large">Etat d'avancement</h2>
-                    
-                    <autoeval-graph
+                    <solid-display
                     bind-resources
                     solid-resource
-                    ></autoeval-graph>
+                    fields="tzcld_profile"
+                    widget-tzcld_profile="autoeval-graph"
+                    ></solid-display>
       
                     <div class="segment full shadow bg-color-white margin-bottom-large padding-large padding-left-small whitespace-normal child-accordion">
                       <h2 class="margin-none margin-top-none margin-left-none text-xlarge text-xbold text-color-heading text-color-dark-blue">Carte d’identité du territoire</h2>
diff --git a/src/widjets-display-evaluation-indicators-tzcld.js b/src/widjets-display-evaluation-indicators-tzcld.js
index 0cbb994..50369e2 100644
--- a/src/widjets-display-evaluation-indicators-tzcld.js
+++ b/src/widjets-display-evaluation-indicators-tzcld.js
@@ -21,11 +21,14 @@ import("./utils.js").then((utils) => {
             <div></div>
             <div></div>
           </div></div>`;
+          let communityTzcldprofile = {
+            profile: await this.resource,
+
+          };
           let tzcldprofile = {
-            community: await this.resource,
+            community: await communityTzcldprofile.profile.community,
 
           };
-          console.log(tzcldprofile.community) ;
           let ResourceAnswers = (await tzcldprofile.community.community_answer) ;
           let answers = ResourceAnswers["ldp:contains"] ;
           let community_id = utils.getIntId(tzcldprofile.community['@id']) ;
@@ -43,11 +46,8 @@ import("./utils.js").then((utils) => {
             let pointPartOrder = await pointPartResource.order ;
             let pointPartLabel = await pointPartResource.title ;
             let prevLabel = null ;
-            console.log('------------------------------------------------------') ;
-            console.log(tzcldprofile.community['@id']) ;
-            console.log(await answer['@id']) ;
 
-            core.store.subscribeVirtualContainerTo(tzcldprofile.community['@id'], await answer['@id']);
+            core.store.subscribeVirtualContainerTo(communityTzcldprofile.profile['@id'], await answer['@id']);
             if (await answer.answer == true) {
               if (typeof points[pointPartId] != "undefined") {
                 points[pointPartId].data++ ;
-- 
GitLab