From 3288e99540ab8803374ef96fd159507692624b86 Mon Sep 17 00:00:00 2001
From: mpgdd <52754938+mpgdd@users.noreply.github.com>
Date: Tue, 6 Aug 2024 14:20:27 +0200
Subject: [PATCH] Update index.html
Added new contact form
Changed readiness score to percentages
---
calculators/index.html | 87 +++++++++++++++++++++++++-----------------
1 file changed, 51 insertions(+), 36 deletions(-)
diff --git a/calculators/index.html b/calculators/index.html
index b6a3764..9f4209b 100644
--- a/calculators/index.html
+++ b/calculators/index.html
@@ -445,15 +445,13 @@
Learn more about my results
-
+
Feedback Opportunity
We are excited for you to try out the Exit to Community Calculator! As this is an ongoing research project, we would be thrilled to get in touch to get your feedback on the tool. If you do not want to give feedback then no further data from you will be stored by this website.
-
-
+
+
+
@@ -663,23 +661,61 @@ Feedback Opportunity
function updateLearnMoreContent() {
const sectionScores = document.getElementById('section-scores');
+ const sectionTotals = {
+ 'Strategy & Planning': 439,
+ 'Governance': 159,
+ 'Internal Systems': 103,
+ 'Leadership': 277,
+ 'Participatory Culture': 356,
+ 'Legal and Regulatory Requirements': 80
+ };
+
let scoresHtml = '';
- radarData.labels.forEach((section, index) => {
- const score = radarData.datasets[0].data[index].toFixed(2);
+ Object.entries(sectionTotals).forEach(([section, totalScore]) => {
+ let actualScore = 0;
+ let questionRange;
+
+ switch(section) {
+ case 'Strategy & Planning':
+ questionRange = Array.from({length: 8}, (_, i) => i + 1);
+ break;
+ case 'Governance':
+ questionRange = Array.from({length: 3}, (_, i) => i + 9);
+ break;
+ case 'Internal Systems':
+ questionRange = Array.from({length: 5}, (_, i) => i + 12);
+ break;
+ case 'Leadership':
+ questionRange = Array.from({length: 4}, (_, i) => i + 17);
+ break;
+ case 'Participatory Culture':
+ questionRange = Array.from({length: 6}, (_, i) => i + 21);
+ break;
+ case 'Legal and Regulatory Requirements':
+ questionRange = Array.from({length: 2}, (_, i) => i + 27);
+ break;
+ }
+
+ questionRange.forEach(q => {
+ if (answers[q] === 'yes') {
+ actualScore += questionValues[q];
+ }
+ });
+
+ const percentage = ((actualScore / totalScore) * 100).toFixed(2);
+
scoresHtml += `
-
${section}: ${score}
-
${getScoreDescription(section, score)}
+
${section}: ${percentage}%
+
${getScoreDescription(percentage)}
`;
});
sectionScores.innerHTML = scoresHtml;
}
- function getScoreDescription(section, score) {
- const maxScore = sectionTotals[Object.keys(sectionTotals)[radarData.labels.indexOf(section)]];
- const percentage = (score / maxScore) * 100;
-
+ function getScoreDescription(percentage) {
+ percentage = parseFloat(percentage);
if (percentage >= 80) {
return "Excellent! You're well-prepared in this area.";
} else if (percentage >= 60) {
@@ -690,28 +726,7 @@ ${section}: ${score}
return "This area needs substantial attention before considering an exit to community.";
}
}
-
- document.getElementById('email-form').addEventListener('submit', function(e) {
- e.preventDefault();
- const email = document.getElementById('email-input').value;
- fetch('/submit-email', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ email: email }),
- })
- .then(response => response.text())
- .then(data => {
- alert('Thank you for your interest! We will be in touch soon.');
- document.getElementById('email-input').value = '';
- })
- .catch((error) => {
- console.error('Error:', error);
- alert('An error occurred. Please try again.');
- });
- });