Updated report system to analyse subsets
This commit is contained in:
parent
7d571d240d
commit
bf17427cc4
40
db.php
40
db.php
@ -130,10 +130,50 @@ $stmt = $pdo->prepare("
|
|||||||
'text' => $text,
|
'text' => $text,
|
||||||
'value' => $value
|
'value' => $value
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($qid == "QID68"){
|
||||||
|
updateResponseQ1($pdo, $value, $responseId);
|
||||||
|
}
|
||||||
|
if ($qid == "QID69"){
|
||||||
|
updateResponseQ2($pdo, $value, $responseId);
|
||||||
|
}
|
||||||
|
if ($qid == "QID70"){
|
||||||
|
updateResponseQ3($pdo, $value, $responseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateResponseQ1(PDO $pdo, int $q1Value, string $responseId): bool {
|
||||||
|
$sql = "UPDATE Responses SET Q1 = :q1 WHERE id = :responseId";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->bindParam(':q1', $q1Value, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
|
||||||
|
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateResponseQ2(PDO $pdo, int $q2Value, string $responseId): bool {
|
||||||
|
$sql = "UPDATE Responses SET Q2 = :q2 WHERE id = :responseId";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->bindParam(':q2', $q2Value, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
|
||||||
|
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateResponseQ3(PDO $pdo, int $q3Value, string $responseId): bool {
|
||||||
|
$sql = "UPDATE Responses SET Q3 = :q3 WHERE id = :responseId";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->bindParam(':q3', $q3Value, PDO::PARAM_INT);
|
||||||
|
$stmt->bindParam(':responseId', $responseId, PDO::PARAM_STR);
|
||||||
|
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
10
drawbar.js
10
drawbar.js
@ -28,8 +28,8 @@ SOFTWARE.
|
|||||||
|
|
||||||
|
|
||||||
function drawBar(id,data) {
|
function drawBar(id,data) {
|
||||||
console.log(id);
|
//console.log(id);
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
const svg = d3.select(`${id}`);
|
const svg = d3.select(`${id}`);
|
||||||
const backgroundwidth = +svg.attr("width");
|
const backgroundwidth = +svg.attr("width");
|
||||||
const backgroundradius = 10;
|
const backgroundradius = 10;
|
||||||
@ -297,7 +297,7 @@ function doBarData(id,qid, survey, Q1=0, Q2=0, Q3=0 ) {
|
|||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// Output result
|
// Output result
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
const parsed = JSON.parse(data);
|
const parsed = JSON.parse(data);
|
||||||
|
|
||||||
// 2. Clean the keys and build a usable object
|
// 2. Clean the keys and build a usable object
|
||||||
@ -308,9 +308,9 @@ function doBarData(id,qid, survey, Q1=0, Q2=0, Q3=0 ) {
|
|||||||
bardata[cleanKey] = entry[rawKey];
|
bardata[cleanKey] = entry[rawKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(bardata);
|
//console.log(bardata);
|
||||||
const total = Object.values(bardata).reduce((sum, value) => sum + value, 0);
|
const total = Object.values(bardata).reduce((sum, value) => sum + value, 0);
|
||||||
console.log(total);
|
//console.log(total);
|
||||||
document.getElementById("record_no").textContent = total;
|
document.getElementById("record_no").textContent = total;
|
||||||
if (total < 9){
|
if (total < 9){
|
||||||
return;
|
return;
|
||||||
|
@ -43,7 +43,7 @@ if (rag !== "")
|
|||||||
{
|
{
|
||||||
polycolour = rag;
|
polycolour = rag;
|
||||||
textcolour = "black";
|
textcolour = "black";
|
||||||
console.log("rag: "+rag);
|
//console.log("rag: "+rag);
|
||||||
opacity = 0.6;
|
opacity = 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if (rag !== "")
|
|||||||
{
|
{
|
||||||
polycolour = rag;
|
polycolour = rag;
|
||||||
textcolour = "black";
|
textcolour = "black";
|
||||||
console.log("rag: "+rag);
|
//console.log("rag: "+rag);
|
||||||
opacity = 0.6;
|
opacity = 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ header('Content-Type: application/json');
|
|||||||
if (php_sapi_name() === 'cli') {
|
if (php_sapi_name() === 'cli') {
|
||||||
echo "Running from command line.\n";
|
echo "Running from command line.\n";
|
||||||
$qid="QID2_7";
|
$qid="QID2_7";
|
||||||
|
$survey="SV_cwKjMqAqGxImjMG";
|
||||||
$q1 = 1;
|
$q1 = 1;
|
||||||
$q2 = 2;
|
$q2 = 2;
|
||||||
$q3 = 0;
|
$q3 = 0;
|
||||||
@ -70,18 +71,16 @@ try {
|
|||||||
$baseSql = "
|
$baseSql = "
|
||||||
SELECT
|
SELECT
|
||||||
a.value,
|
a.value,
|
||||||
COUNT(*) AS count,
|
COUNT(*) AS count
|
||||||
r.Q1,
|
|
||||||
r.Q2,
|
|
||||||
r.Q3
|
|
||||||
FROM Answers a
|
FROM Answers a
|
||||||
INNER JOIN Responses r ON a.responseId = r.id
|
INNER JOIN Responses r ON a.responseId = r.id
|
||||||
INNER JOIN Surveys s ON a.surveyId = s.id
|
INNER JOIN Surveys s ON a.surveyId = s.id
|
||||||
WHERE a.QID = :qid
|
WHERE a.QID = :qid
|
||||||
";
|
";
|
||||||
|
|
||||||
|
//GROUP BY a.value, r.Q1, r.Q2, r.Q3
|
||||||
$sql = $baseSql . $qualifier . "
|
$sql = $baseSql . $qualifier . "
|
||||||
GROUP BY a.value, r.Q1, r.Q2, r.Q3
|
GROUP BY a.value
|
||||||
ORDER BY a.value;
|
ORDER BY a.value;
|
||||||
";
|
";
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ function insertQualifiers(){
|
|||||||
// Output result
|
// Output result
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const parsed = JSON.parse(data);
|
const parsed = JSON.parse(data);
|
||||||
console.log (parsed["1"]);
|
|
||||||
document.querySelector('label[for="location"]').textContent = parsed["1"][0];
|
document.querySelector('label[for="location"]').textContent = parsed["1"][0];
|
||||||
|
|
||||||
// .shift(); //
|
// .shift(); //
|
||||||
|
@ -12,7 +12,7 @@ function RAGGED(average){
|
|||||||
|
|
||||||
|
|
||||||
function getAverage(prefix) {
|
function getAverage(prefix) {
|
||||||
console.log("Prefix:", prefix);
|
//console.log("Prefix:", prefix);
|
||||||
|
|
||||||
const elements = Array.from(document.querySelectorAll(`svg[id^="${prefix}"] tspan.average`));
|
const elements = Array.from(document.querySelectorAll(`svg[id^="${prefix}"] tspan.average`));
|
||||||
|
|
||||||
@ -48,7 +48,6 @@ function getSurveyData(){
|
|||||||
let Q3=document.getElementById("gov").value;
|
let Q3=document.getElementById("gov").value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let amber = '#ffbf00';
|
let amber = '#ffbf00';
|
||||||
//doBigWhiteTriangle('svg1');
|
//doBigWhiteTriangle('svg1');
|
||||||
//drawtriangle('#svg1','Roles','#008845',[0.5,0.6,0.5],'red', { x: 0, y: 350 },-0.7);
|
//drawtriangle('#svg1','Roles','#008845',[0.5,0.6,0.5],'red', { x: 0, y: 350 },-0.7);
|
||||||
|
@ -14,11 +14,30 @@
|
|||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
margin: 0;
|
margin: 5px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#surveyForm {
|
||||||
|
border: 20px solid white;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#surveyForm input#surveyId {
|
||||||
|
width: 315px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#surveyForm input, #surveyForm label {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#surveyForm select {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
.pyramid {
|
.pyramid {
|
||||||
width: 40%;
|
width: 40%;
|
||||||
height: auto;
|
height: auto;
|
||||||
@ -80,6 +99,9 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -90,7 +112,7 @@
|
|||||||
<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>
|
<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" />
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -138,10 +160,13 @@
|
|||||||
|
|
||||||
<p>To bring the EO Framework to life, we have created a simple health check - the eoQ™ test - to help you assess the strength of your current EO practice and signpost areas for possible improvement. It should take up to 20-30 minutes to complete the questionnaire.</p>
|
<p>To bring the EO Framework to life, we have created a simple health check - the eoQ™ test - to help you assess the strength of your current EO practice and signpost areas for possible improvement. It should take up to 20-30 minutes to complete the questionnaire.</p>
|
||||||
|
|
||||||
<svg class="pyramid" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid" width="1000" height="1000"></svg>
|
<div id="pyramids">
|
||||||
<svg class="pyramid" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG" width="1000" height="1000"></svg>
|
<svg class="pyramid" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid" width="1000" height="1000"></svg>
|
||||||
<svg class="pyramid no-axis no-text big-number" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG_test" width="1000" height="1000"></svg>
|
<svg class="pyramid" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG" width="1000" height="1000"></svg>
|
||||||
<svg class="pyramid no-axis big-number" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG_test2" width="1000" height="1000"></svg>
|
<svg class="pyramid no-axis no-text big-number" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG_test" width="1000" height="1000"></svg>
|
||||||
|
<svg class="pyramid no-axis big-number" style="display: inline-block" xmlns="http://www.w3.org/2000/svg" id="svg_pyramid_RAG_test2" width="1000" height="1000"></svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user