Added total number of records to page

This commit is contained in:
Peter Edmond 2025-05-31 03:38:30 +01:00
parent 5b4f7b5119
commit 943ae44e2b
3 changed files with 10 additions and 4 deletions

View File

@ -68,10 +68,9 @@ CREATE TABLE `Users` (
CREATE TABLE Filters ( CREATE TABLE Filters (
id INT NOT NULL AUTO_INCREMENT, id INT NOT NULL AUTO_INCREMENT,
surveyId INT NOT NULL, surveyId VARCHAR(20),
FilterQuestion INT NOT NULL, FilterQuestion INT NOT NULL,
FilterOption INT NOT NULL, FilterOption INT NOT NULL,
Text VARCHAR(128), Text VARCHAR(128),
PRIMARY KEY (id), PRIMARY KEY (id)
FOREIGN KEY (surveyId) REFERENCES Surveys(id)
); );

View File

@ -309,6 +309,12 @@ function doBarData(id,qid, survey, Q1=0, Q2=0, Q3=0 ) {
}); });
console.log(bardata); 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); drawBar(id,bardata);
// return data; // Should be an array like [{ value: -3, count: 2 }, ..., { value: 3, count: 5 }] // return data; // Should be an array like [{ value: -3, count: 2 }, ..., { value: 3, count: 5 }]

View File

@ -87,6 +87,7 @@
<h1>QUALTRICS SURVEY ANALYSIS TOOL</h1> <h1>QUALTRICS SURVEY ANALYSIS TOOL</h1>
<p>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.</p> <p>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.</p>
<p>SV_bD838sNKZEmi6Tc is also worth experimenting with</p>
<form id="surveyForm"> <form id="surveyForm">
<label for="surveyId">Survey iD</label> <label for="surveyId">Survey iD</label>
<input type="text" id="surveyId" name="surveyId" /> <input type="text" id="surveyId" name="surveyId" />
@ -122,7 +123,7 @@
</form> </form>
</div> </div>
<p>Number of completed surveys. (No data will be shown if this is less than 8) : </p> <p>Number of completed surveys. (No data will be shown if this is less than 8) : <span id="record_no">0</span></p>
<hr> <hr>