|
|
@@ -9,6 +9,7 @@ $pass_count = 0;
|
|
|
$pass_fail_test_count = 0;
|
|
|
$completed_tests = null;
|
|
|
$year_cycle_start_text = null;
|
|
|
+$stage_chart = null;
|
|
|
|
|
|
$pass_rate = null;
|
|
|
$logo_path = null;
|
|
|
@@ -24,9 +25,7 @@ if($user->isCustomer()) {
|
|
|
$logo_path = $customer->getLogoPath();
|
|
|
|
|
|
$page_title = __("%s Dashboard", $customer->name);
|
|
|
- $year_cycle = $customer->getYearCycleDates();
|
|
|
-
|
|
|
- list($start, $end) = $year_cycle;
|
|
|
+ [$start, $end] = $customer->getYearCycleDates();
|
|
|
|
|
|
$dt = new DateTime($start);
|
|
|
$year_cycle_start_text = $dt->format("jS M");
|
|
|
@@ -43,9 +42,33 @@ if($user->isCustomer()) {
|
|
|
|
|
|
$tests = $test_result_set->filterByDateRange($start, $end);
|
|
|
|
|
|
+
|
|
|
$test_count = count($tests);
|
|
|
|
|
|
- $pass_fail_tests = array_filter($tests, function(Test $test) {
|
|
|
+ if($test_count > 0) {
|
|
|
+ $total_data = (object) [
|
|
|
+ "stage1Count" => 0,
|
|
|
+ "stage2Count" => 0,
|
|
|
+ "stage3Count" => 0,
|
|
|
+ "stage4Count" => 0,
|
|
|
+ "stage5Count" => 0,
|
|
|
+ ];
|
|
|
+
|
|
|
+ foreach($tests as $test) {
|
|
|
+ if($test->challenge_stage <= 0) continue;
|
|
|
+
|
|
|
+ $key = sprintf("stage%dCount", $test->challenge_stage);
|
|
|
+
|
|
|
+ ++$total_data->$key;
|
|
|
+ }
|
|
|
+
|
|
|
+ $chart_generator = new ChartGenerator($total_data, []);
|
|
|
+ $chart_generator->setDateRangeLabel(__("YTD"));
|
|
|
+
|
|
|
+ $stage_chart = $chart_generator->getTestsByStageChart();
|
|
|
+ }
|
|
|
+
|
|
|
+ $pass_fail_tests = array_filter($tests, static function(Test $test) {
|
|
|
$project = $test->getProject();
|
|
|
$template = $project->getTemplate();
|
|
|
return $template->hasPassFail();
|
|
|
@@ -205,6 +228,6 @@ if($tests_pending_verification) {
|
|
|
$referrals = $user->getReferrals();
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
-View::include("account", compact("page_title", "icons", "actions", "to_do", "referrals", "customer", "logo_path", "year_cycle_start_text", "pass_rate", "pass_count", "pass_fail_test_count", "test_count"));
|
|
|
+View::include("account", compact("page_title", "icons", "actions", "to_do", "referrals", "customer", "logo_path", "year_cycle_start_text", "pass_rate", "pass_count", "pass_fail_test_count", "test_count", "stage_chart"));
|
|
|
View::includeOnce("footer");
|
|
|
|