|
|
@@ -2,17 +2,17 @@
|
|
|
|
|
|
Core::addScript("public/js/Chart.bundle.min.js");
|
|
|
Core::addScript("public/js/chartjs-plugin-datalabels.min.js");
|
|
|
-Core::addScript("public/js/app-performance.js");
|
|
|
+Core::addScript("public/js/app-reports.js");
|
|
|
|
|
|
Core::addBreadcrumb("/account", "Account");
|
|
|
-Core::addBreadcrumb("/account/performance", "Performance");
|
|
|
+Core::addBreadcrumb("/account/reports", "Reports");
|
|
|
|
|
|
$customer = Customer::getForAdmin();
|
|
|
if(!$customer) throw new Exception("You do not have permission to access this page.");
|
|
|
|
|
|
-$page_title = "$customer->name Performance";
|
|
|
+$page_title = "$customer->name Reports";
|
|
|
|
|
|
-Core::addBreadcrumb("/account/performance?customer_id=$customer->id", $page_title);
|
|
|
+Core::addBreadcrumb("/account/reports?customer_id=$customer->id", $page_title);
|
|
|
|
|
|
$date_range = http::value("date_range");
|
|
|
if(!$date_range) $date_range = "ytd";
|
|
|
@@ -426,10 +426,10 @@ if($submit) {
|
|
|
// Tests by Stage
|
|
|
|
|
|
$chart = new Chart;
|
|
|
- $chart->setType("pie");
|
|
|
+ $chart->setType("doughnut");
|
|
|
$chart->setTitle("Tests by Stage $date_range_label");
|
|
|
$chart->setLabels(["1 - On Entry", "2 - While Browsing", "3 - During Play", "4 - On Exit", "5 - No Challenge"]);
|
|
|
- $chart->addDataset("Counts", [
|
|
|
+ $chart->addDataset("Tests", [
|
|
|
$total_data->stage1Count,
|
|
|
$total_data->stage2Count,
|
|
|
$total_data->stage3Count,
|
|
|
@@ -442,9 +442,12 @@ if($submit) {
|
|
|
"#FBC02D",
|
|
|
"#FFAB91",
|
|
|
"#F44336",
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ "datalabels" => [
|
|
|
+ "backgroundColor" => "rgba(0, 0, 0, 0.75)",
|
|
|
+ "borderRadius" => "2",
|
|
|
+ ],
|
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes(" Test");
|
|
|
$chart->setPrintSuffixes("");
|
|
|
$chart->print = true;
|
|
|
$chart->printPercentages = true;
|
|
|
@@ -505,20 +508,38 @@ if($submit) {
|
|
|
$charts[] = $chart;
|
|
|
|
|
|
// Pass Rate Period
|
|
|
- $performance = array_values(array_map(function($d) {
|
|
|
+ $pass_rates = array_values(array_map(function($d) {
|
|
|
if($d->testCount == 0) return 0;
|
|
|
return round(($d->passCount / $d->testCount) * 100);
|
|
|
}, $data));
|
|
|
|
|
|
+ $fail_rates = array_values(array_map(function($d) {
|
|
|
+ if($d->testCount == 0) return 0;
|
|
|
+ $pass_rate = round(($d->passCount / $d->testCount) * 100);
|
|
|
+ return 100 - $pass_rate;
|
|
|
+ }, $data));
|
|
|
+
|
|
|
$chart = new Chart;
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addXAxis([
|
|
|
+ "type" => "category",
|
|
|
+ "stacked" => true,
|
|
|
+ ]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100],
|
|
|
+ "stacked" => true,
|
|
|
+ ]);
|
|
|
+
|
|
|
$chart->setType("bar");
|
|
|
- $chart->setTitle("Pass Rate by $resolution_name");
|
|
|
+ $chart->setTitle("Pass / Fail by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
- $chart->addDataset("Pass Rate (%)", $performance, [
|
|
|
- "background_colours" => "#2196F3"
|
|
|
+ $chart->addDataset("Pass Rate (%)", $pass_rates, [
|
|
|
+ "background_colours" => "#4CAF50"
|
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes("%");
|
|
|
+ $chart->addDataset("Fail Rate (%)", $fail_rates, [
|
|
|
+ "background_colours" => "#F44336"
|
|
|
+ ]);
|
|
|
+ $chart->setDatalabelSuffixes("%", "%");
|
|
|
$charts[] = $chart;
|
|
|
|
|
|
// Totals by Period
|
|
|
@@ -531,10 +552,18 @@ if($submit) {
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Totals by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]);
|
|
|
- $chart->addYAxis("linear", "right", "y-axis-2", false, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]
|
|
|
+ ]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "position" => "right",
|
|
|
+ "id" => "y-axis-2",
|
|
|
+ "grid_lines" => false,
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100]
|
|
|
+ ]);
|
|
|
|
|
|
- $chart->addDataset("Pass Rate (%)", $performance, [
|
|
|
+ $chart->addDataset("Pass Rate (%)", $pass_rates, [
|
|
|
"border_colours" => "#FFEB3B",
|
|
|
"background_colours" => "transparent",
|
|
|
"type" => "line",
|
|
|
@@ -542,6 +571,7 @@ if($submit) {
|
|
|
"datalabels" => [
|
|
|
"display" => false
|
|
|
],
|
|
|
+ "line_tension" => 0,
|
|
|
]);
|
|
|
$chart->addDataset("Test Count", $test_counts, [
|
|
|
"background_colours" => "#2196F3",
|
|
|
@@ -597,9 +627,12 @@ if($submit) {
|
|
|
"#FBC02D",
|
|
|
"#FFAB91",
|
|
|
"#F44336",
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ "datalabels" => [
|
|
|
+ "backgroundColor" => "rgba(0, 0, 0, 0.75)",
|
|
|
+ "borderRadius" => "2",
|
|
|
+ ],
|
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes(" Test");
|
|
|
$charts[] = $chart;
|
|
|
}
|
|
|
|
|
|
@@ -613,7 +646,11 @@ if($submit) {
|
|
|
}, $data));
|
|
|
|
|
|
$chart = new Chart;
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => ceil(max(max($male_counts), max($female_counts)) / 10) * 10]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => ceil(max(max($male_counts), max($female_counts)) / 10) * 10]
|
|
|
+ ]);
|
|
|
+
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Tester Gender by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
@@ -623,7 +660,6 @@ if($submit) {
|
|
|
$chart->addDataset("Female", $female_counts, [
|
|
|
"background_colours" => "#E91E63"
|
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes(" M", " F");
|
|
|
$charts[] = $chart;
|
|
|
|
|
|
// Test Count by Period
|
|
|
@@ -632,14 +668,16 @@ if($submit) {
|
|
|
}, $data));
|
|
|
|
|
|
$chart = new Chart;
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Tests by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
$chart->addDataset("Tests", $test_counts, [
|
|
|
"background_colours" => "#2196F3"
|
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes(" Test");
|
|
|
$charts[] = $chart;
|
|
|
|
|
|
$pass_counts = array_column($data, "passCount");
|
|
|
@@ -665,7 +703,10 @@ if($submit) {
|
|
|
}
|
|
|
|
|
|
$chart = new Chart;
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100]
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Region Pass Rate $date_range_label");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
@@ -677,7 +718,10 @@ if($submit) {
|
|
|
|
|
|
// Region Pass Rate Period
|
|
|
$chart = new Chart;
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100]
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Region Pass Rate by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
@@ -724,7 +768,10 @@ if($submit) {
|
|
|
"labelString" => "Area Manager",
|
|
|
]
|
|
|
]);
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100]
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Area Manager Pass Rate $date_range_label");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
@@ -743,7 +790,10 @@ if($submit) {
|
|
|
"labelString" => "Area Manager",
|
|
|
]
|
|
|
]);
|
|
|
- $chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => 100]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-1",
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100]
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Area Manager Pass Rate by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
|
@@ -754,7 +804,12 @@ if($submit) {
|
|
|
$a_data = $area_manager_data[$area_manager][$key];
|
|
|
$data_values[] = ($a_data->testCount == 0) ? 0 : round(($a_data->passCount * 100) / $a_data->testCount);
|
|
|
}
|
|
|
- $chart->addDataset($key_labels[$index], $data_values, ["background_colours" => $colours[$index]]);
|
|
|
+ $chart->addDataset($key_labels[$index], $data_values, [
|
|
|
+ "background_colours" => $colours[$index],
|
|
|
+ "datalabels" => [
|
|
|
+ "display" => false,
|
|
|
+ ],
|
|
|
+ ]);
|
|
|
}
|
|
|
$chart->setDatalabelSuffixes(...array_fill(0, count($keys), "%"));
|
|
|
|
|
|
@@ -779,7 +834,7 @@ if($submit) {
|
|
|
case "export-pptx":
|
|
|
case "export-odp":
|
|
|
|
|
|
- require "performance_presentation.php";
|
|
|
+ require "reports_presentation.php";
|
|
|
|
|
|
break;
|
|
|
default:
|
|
|
@@ -791,7 +846,7 @@ if($submit) {
|
|
|
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
-View::include("performance", 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"));
|
|
|
View::includeOnce("footer");
|
|
|
|
|
|
?>
|