Просмотр исходного кода

Add Extra Information for web reports for production

Alan Lam 8 лет назад
Родитель
Сommit
07e2b05b43
2 измененных файлов с 94 добавлено и 88 удалено
  1. 1 1
      controllers/reports.php
  2. 93 87
      views/reports.php

+ 1 - 1
controllers/reports.php

@@ -852,7 +852,7 @@ if($submit) {
 
 
 View::includeOnce("header", compact("page_title"));
-View::include("reports", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data"));
+View::include("reports", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data", "key_labels"));
 View::includeOnce("footer");
 
 ?>

+ 93 - 87
views/reports.php

@@ -324,106 +324,112 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 			<?php
 		}
 
-		if(PRODUCTION == false) {
-			?>
-			<div class="d-print-none">
-				<h2>Debug Information</h2>
-
-				<h3>Region Data</h3>
+		?>
+		<div class="d-print-none">
+			<h2>Extra Information</h2>
 
-				<?php
+			<h3>Region Data</h3>
 
-				foreach($region_data as $region => $rows) {
+			<?php
 
-					?>
-					<h4>Region: <?=htmlspecialchars($region)?></h4>
-
-					<table class="table">
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<thead>
-							<tr>
-								<th>Key</th>
-								<th>Tests</th>
-								<th>Passes</th>
-								<th>Fails</th>
-								<th>Rate</th>
-							</tr>
-						</thead>
-						<tbody>
-						<?php
-						foreach($rows as $key => $data) {
-							$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
-							?>
-							<tr>
-								<td><?=htmlspecialchars($key)?></td>
-								<td><?=number_format($data->testCount)?></td>
-								<td><?=number_format($data->passCount)?></td>
-								<td><?=number_format($data->failCount)?></td>
-								<td><?=$rate?>%</td>
-							</tr>
-							<?php
-						}
-						?>
-						</tbody>
-					</table>
+			foreach($region_data as $region => $rows) {
 
+				?>
+				<h4>Region: <?=htmlspecialchars($region)?></h4>
+
+				<table class="table">
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<thead>
+						<tr>
+							<th>Period</th>
+							<th>Tests</th>
+							<th>Passes</th>
+							<th>Fails</th>
+							<th>Rate</th>
+						</tr>
+					</thead>
+					<tbody>
 					<?php
 
-				}
+					$index = 0;
+
+					foreach($rows as $key => $data) {
+						$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
+						$label = $key_labels[$index];
+						?>
+						<tr>
+							<td><?=htmlspecialchars($label)?></td>
+							<td><?=number_format($data->testCount)?></td>
+							<td><?=number_format($data->passCount)?></td>
+							<td><?=number_format($data->failCount)?></td>
+							<td><?=$rate?>%</td>
+						</tr>
+						<?php
+						$index++;
+					}
+					?>
+					</tbody>
+				</table>
 
-				?>
-				<h3>Area Manager Data</h3>
 				<?php
 
-				foreach($area_manager_data as $area_manager => $rows) {
+			}
 
-					?>
-					<h4>Area Manager: <?=htmlspecialchars($area_manager)?></h4>
-
-					<table class="table">
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<thead>
-							<tr>
-								<th>Key</th>
-								<th>Tests</th>
-								<th>Passes</th>
-								<th>Fails</th>
-								<th>Rate</th>
-							</tr>
-						</thead>
-						<tbody>
-						<?php
-						foreach($rows as $key => $data) {
-							$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
-							?>
-							<tr>
-								<td><?=htmlspecialchars($key)?></td>
-								<td><?=number_format($data->testCount)?></td>
-								<td><?=number_format($data->passCount)?></td>
-								<td><?=number_format($data->failCount)?></td>
-								<td><?=$rate?>%</td>
-							</tr>
-							<?php
-						}
-						?>
-						</tbody>
-					</table>
+			?>
+			<h3>Area Manager Data</h3>
+			<?php
+
+			foreach($area_manager_data as $area_manager => $rows) {
 
+				?>
+				<h4>Area Manager: <?=htmlspecialchars($area_manager)?></h4>
+
+				<table class="table">
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<thead>
+						<tr>
+							<th>Period</th>
+							<th>Tests</th>
+							<th>Passes</th>
+							<th>Fails</th>
+							<th>Rate</th>
+						</tr>
+					</thead>
+					<tbody>
 					<?php
+					$index = 0;
+					foreach($rows as $key => $data) {
+						$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
+						$label = $key_labels[$index];
+						?>
+						<tr>
+							<td><?=htmlspecialchars($label)?></td>
+							<td><?=number_format($data->testCount)?></td>
+							<td><?=number_format($data->passCount)?></td>
+							<td><?=number_format($data->failCount)?></td>
+							<td><?=$rate?>%</td>
+						</tr>
+						<?php
+						$index++;
+					}
+					?>
+					</tbody>
+				</table>
 
-				}
-			?>
-			</div>
-			<?php
-		}
+				<?php
+
+			}
+		?>
+		</div>
+		<?php
 
 	}
 	?>