From 1d02a9eb7f13821a0be1982c4bbde253005e6ff2 Mon Sep 17 00:00:00 2001
From: Alexis POYEN <apoyen@grandlyon.com>
Date: Wed, 5 Aug 2020 10:02:24 +0200
Subject: [PATCH] Resolve "Potential incompatibility for electeds"

---
 web/components/management/election.js             |  7 ++++++-
 web/components/visualization/results-detaileds.js | 15 +++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/web/components/management/election.js b/web/components/management/election.js
index ec0a71e..92d194e 100644
--- a/web/components/management/election.js
+++ b/web/components/management/election.js
@@ -340,6 +340,11 @@ class Election {
     document.getElementById("election-modal-name").value = election.Name;
     document.getElementById("election-modal-ballot-type").value =
       election.BallotType;
+
+    document.getElementById("election-modal-area-map").value =
+      election.MapAreaFile;
+    document.getElementById("election-modal-section-map").value =
+      election.MapSectionFile;
     Common.toggleModal("election-modal", "election-modal-card");
   }
 
@@ -353,7 +358,7 @@ class Election {
         this.method,
         parseInt(document.getElementById("election-modal-id").value),
         document.getElementById("election-modal-name").value,
-        document.getElementById("election-modal-ballot-type").value,
+        document.getElementById("election-modal-ballot-type").value
       )
     ) {
       election = await this.ElectionModel.saveElection(
diff --git a/web/components/visualization/results-detaileds.js b/web/components/visualization/results-detaileds.js
index 505e000..69190ec 100644
--- a/web/components/visualization/results-detaileds.js
+++ b/web/components/visualization/results-detaileds.js
@@ -198,15 +198,22 @@ class DetailedsResultsComponent {
       this.parent.parent.zone === "areas" &&
       zone.stats.PercentageConsiderated == 100
     ) {
-      document.getElementById("zone-detaileds-results").innerHTML +=
-        '<br/><h5 class="title is-5">Élus</h5>';
+      let electedsZone = document.getElementById("zone-detaileds-results");
+      electedsZone.innerHTML = '<br/><h5 class="title is-5">Élus</h5>';
+      let electedList = document.createElement("ol");
+      let li;
       for (let i in zone.Electeds) {
         let candidateList = await this.CandidateListModel.getCandidateList(
           zone.Electeds[i].CandidateListID
         );
-        document.getElementById("zone-detaileds-results").innerHTML +=
-          zone.Electeds[i].FullName + " (" + candidateList.Name + ")<br/>";
+        li = document.createElement("li");
+        li.innerHTML =
+          zone.Electeds[i].FullName + " (" + candidateList.Name + ")";
+        if (zone.Electeds[i].PotentialIncompatibility)
+          li.style.backgroundColor = "rgba(255,185,0,.95)";
+        electedList.appendChild(li);
       }
+      electedsZone.appendChild(electedList);
     }
   }
 }
-- 
GitLab