From 943ae44e2b327d31871f21994e41e1a663778e20 Mon Sep 17 00:00:00 2001 From: Peter Edmond Date: Sat, 31 May 2025 03:38:30 +0100 Subject: [PATCH] Added total number of records to page --- MakeDatabase.sql | 5 ++--- drawbar.js | 6 ++++++ reportTemplate.html | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/MakeDatabase.sql b/MakeDatabase.sql index ac4a601..7d1f5b6 100644 --- a/MakeDatabase.sql +++ b/MakeDatabase.sql @@ -68,10 +68,9 @@ CREATE TABLE `Users` ( CREATE TABLE Filters ( id INT NOT NULL AUTO_INCREMENT, - surveyId INT NOT NULL, + surveyId VARCHAR(20), FilterQuestion INT NOT NULL, FilterOption INT NOT NULL, Text VARCHAR(128), - PRIMARY KEY (id), - FOREIGN KEY (surveyId) REFERENCES Surveys(id) + PRIMARY KEY (id) ); \ No newline at end of file diff --git a/drawbar.js b/drawbar.js index cdb9443..e6cfd45 100644 --- a/drawbar.js +++ b/drawbar.js @@ -309,6 +309,12 @@ function doBarData(id,qid, survey, Q1=0, Q2=0, Q3=0 ) { }); console.log(bardata); + const total = Object.values(bardata).reduce((sum, value) => sum + value, 0); + console.log(total); + document.getElementById("record_no").textContent = total; + if (total < 9){ + return; + } drawBar(id,bardata); // return data; // Should be an array like [{ value: -3, count: 2 }, ..., { value: 3, count: 5 }] diff --git a/reportTemplate.html b/reportTemplate.html index 075d93e..a515817 100644 --- a/reportTemplate.html +++ b/reportTemplate.html @@ -87,6 +87,7 @@

QUALTRICS SURVEY ANALYSIS TOOL

You first need to enter the Survey ID, and press submit in order to get the correct groupings available to select from. The master template survey is SV_cwKjMqAqGxImjMG if you want a survey to just try out.

+

SV_bD838sNKZEmi6Tc is also worth experimenting with

@@ -122,7 +123,7 @@
-

Number of completed surveys. (No data will be shown if this is less than 8) :

+

Number of completed surveys. (No data will be shown if this is less than 8) : 0