From 9cc41e89a32323d4cb96fcaaf54e87ce2bb36a5c Mon Sep 17 00:00:00 2001 From: Vaanshi Madan Date: Mon, 15 Jun 2026 23:16:24 +0530 Subject: [PATCH 1/2] Fix dashboard decimal values to percentage format --- Frontend/Analysis/analysis.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Frontend/Analysis/analysis.js b/Frontend/Analysis/analysis.js index 5dfa76a..f7575b4 100644 --- a/Frontend/Analysis/analysis.js +++ b/Frontend/Analysis/analysis.js @@ -1,3 +1,6 @@ +// Isse decimal value percentage mein convert ho jayegi (e.g., 0.936 -> 93.6%) +const toPercent = (val) => val ? (val * 100).toFixed(1) + '%' : '0%'; + const API_URL = window.location.hostname === "127.0.0.1" || window.location.hostname === "localhost" From edd4ddaf9b31b0b0616c9ed1bf96e289cd4476e2 Mon Sep 17 00:00:00 2001 From: Vaanshi Madan Date: Thu, 18 Jun 2026 11:18:58 +0530 Subject: [PATCH 2/2] Issue #67: Replace decimal risk scores with percentage display --- Frontend/Analysis/analysis.html | 2 +- Frontend/Analysis/analysis.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Frontend/Analysis/analysis.html b/Frontend/Analysis/analysis.html index f1b0098..f6fa934 100644 --- a/Frontend/Analysis/analysis.html +++ b/Frontend/Analysis/analysis.html @@ -245,7 +245,7 @@

🌪 Wind Speed

âš  Climate Risk Analysis
- //Issue #67: Feature implementation: eplacing color-only signals with combined textual indicators +
diff --git a/Frontend/Analysis/analysis.js b/Frontend/Analysis/analysis.js index f7575b4..65b74a5 100644 --- a/Frontend/Analysis/analysis.js +++ b/Frontend/Analysis/analysis.js @@ -1,5 +1,4 @@ -// Isse decimal value percentage mein convert ho jayegi (e.g., 0.936 -> 93.6%) -const toPercent = (val) => val ? (val * 100).toFixed(1) + '%' : '0%'; + const API_URL = window.location.hostname === "127.0.0.1" || @@ -265,7 +264,7 @@ async function getWeatherData() { // Risks scores const floodCard = document.querySelector(".risk-card.flood"); const floodScore = data.risks.flood_risk; - document.getElementById("flood-risk").innerText = floodScore; + document.getElementById("flood-risk").innerText = toPercent(floodScore); let score = floodScore; let card = floodCard; let level = getRiskLevel(score, "flood"); @@ -276,7 +275,7 @@ async function getWeatherData() { const heatCard = document.querySelector(".risk-card.heat"); const heatScore = data.risks.heat_risk; - document.getElementById("heat-risk").innerText = heatScore; + document.getElementById("heat-risk").innerText = toPercent(heatScore); score = heatScore; card = heatCard; level = getRiskLevel(score, "heat"); @@ -286,7 +285,7 @@ async function getWeatherData() { card.querySelector(".risk-description").textContent = level.desc; const wildfireCard = document.querySelector(".risk-card.wildfire"); const wildfireScore = data.risks.wildfire_risk; - document.getElementById("wildfire-risk").innerText = wildfireScore; + document.getElementById("wildfire-risk").innerText = toPercent(wildfireScore); score = wildfireScore; card = wildfireCard; level = getRiskLevel(score, "wildfire"); @@ -297,7 +296,7 @@ async function getWeatherData() { const cycloneCard = document.querySelector(".risk-card.cyclone"); const cycloneScore = data.risks.cyclone_risk; - document.getElementById("cyclone-risk").innerText = cycloneScore; + document.getElementById("cyclone-risk").innerText = toPercent(cycloneScore); score = cycloneScore; card = cycloneCard; level = getRiskLevel(score, "cyclone"); @@ -308,7 +307,7 @@ async function getWeatherData() { const droughtCard = document.querySelector(".risk-card.drought"); const droughtScore = data.risks.drought_risk; - document.getElementById("drought-risk").innerText = droughtScore; + document.getElementById("drought-risk").innerText = toPercent(droughtScore); score = droughtScore; card = droughtCard; level = getRiskLevel(score, "drought"); @@ -330,6 +329,10 @@ async function getWeatherData() { drought: droughtScore, }); + function toPercent(score) { + return (score * 100).toFixed(1) + "%"; +} + recommendationsList.innerHTML = recommendations .map((item) => `
  • ✅ ${item}
  • `) .join("");