Browse Source

Remove 'Answer Rate' chart if no moments have been sent yet in results page

Victor Hernandez 3 years ago
parent
commit
8ad7340f6a
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      respuestas.php

+ 7
- 1
respuestas.php View File

@@ -114,7 +114,7 @@
114 114
 	
115 115
 		<div class="container" style="margin-top: 8rem;">
116 116
 		
117
-			<!-- CHART -->
117
+			<!-- TITLE + EXPORT RAW -->
118 118
 			<div class="row">
119 119
 				<div class="col-sm-10">
120 120
 					<h2>
@@ -355,6 +355,12 @@ function fetchAnswerRate() {
355 355
 			let momentIDToNumber = {};
356 356
 			let number = 1; // start at 1
357 357
 			
358
+			// If no moments have been sent yet, remove chart
359
+			if(dataSet === null) {
360
+				document.getElementById('myChart2').remove();
361
+				return;
362
+			}
363
+			
358 364
 			// Fill Data Containers
359 365
 			dataSet.forEach(function(point) {
360 366