|
@@ -15,8 +15,13 @@ $page_title = "$customer->name Performance";
|
|
|
Core::addBreadcrumb("/account/performance?customer_id=$customer->id", $page_title);
|
|
Core::addBreadcrumb("/account/performance?customer_id=$customer->id", $page_title);
|
|
|
|
|
|
|
|
$date_range = http::value("date_range");
|
|
$date_range = http::value("date_range");
|
|
|
|
|
+if(!$date_range) $date_range = "ytd";
|
|
|
|
|
+
|
|
|
$date_resolution = http::value("date_resolution");
|
|
$date_resolution = http::value("date_resolution");
|
|
|
|
|
|
|
|
|
|
+$from_quarter = http::value("from_quarter");
|
|
|
|
|
+$to_quarter = http::value("to_quarter");
|
|
|
|
|
+
|
|
|
$all_projects = Project::query([
|
|
$all_projects = Project::query([
|
|
|
"customer_id" => $customer->id
|
|
"customer_id" => $customer->id
|
|
|
]);
|
|
]);
|
|
@@ -103,6 +108,9 @@ if($submit) {
|
|
|
$min_year = date("Y");
|
|
$min_year = date("Y");
|
|
|
$max_year = date("Y");
|
|
$max_year = date("Y");
|
|
|
|
|
|
|
|
|
|
+ $min_unix = strtotime("$min_year-01-01 UTC");
|
|
|
|
|
+ $max_unix = strtotime("$max_year-12-31 23:59:59 UTC");
|
|
|
|
|
+
|
|
|
switch($date_range) {
|
|
switch($date_range) {
|
|
|
case "ytd":
|
|
case "ytd":
|
|
|
// Nothing to do
|
|
// Nothing to do
|
|
@@ -124,11 +132,56 @@ if($submit) {
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case "custom":
|
|
case "custom":
|
|
|
- // TODO
|
|
|
|
|
- $date_range_label = "Custom";
|
|
|
|
|
|
|
+ $check = strcmp($from_quarter, $to_quarter);
|
|
|
|
|
+ if($check > 0) {
|
|
|
|
|
+ $temp = $to_quarter;
|
|
|
|
|
+ $from_quarter = $to_quarter;
|
|
|
|
|
+ $to_quarter = $temp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ list($min_year, $min_quarter) = explode("-", $from_quarter);
|
|
|
|
|
+ list($max_year, $max_quarter) = explode("-", $to_quarter);
|
|
|
|
|
+
|
|
|
|
|
+ switch($min_quarter) {
|
|
|
|
|
+ case 1: $unix_string = "$min_year-01-01 UTC"; break;
|
|
|
|
|
+ case 2: $unix_string = "$min_year-04-01 UTC"; break;
|
|
|
|
|
+ case 3: $unix_string = "$min_year-07-01 UTC"; break;
|
|
|
|
|
+ case 4: $unix_string = "$min_year-10-01 UTC"; break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $min_unix = strtotime($unix_string);
|
|
|
|
|
+
|
|
|
|
|
+ switch($max_quarter) {
|
|
|
|
|
+ case 1: $unix_string = "$max_year-03-31 23:59:59 UTC"; break;
|
|
|
|
|
+ case 2: $unix_string = "$max_year-06-30 23:59:59 UTC"; break;
|
|
|
|
|
+ case 3: $unix_string = "$max_year-09-30 23:59:59 UTC"; break;
|
|
|
|
|
+ case 4: $unix_string = "$max_year-12-31 23:59:59 UTC"; break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $max_unix = strtotime($unix_string);
|
|
|
|
|
+
|
|
|
|
|
+ $date_range_label = "$min_year Q$min_quarter - $max_year Q$max_quarter";
|
|
|
|
|
+
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Filter tests based on date range
|
|
|
|
|
+ $tests = array_filter($tests, function($test) use ($min_unix, $max_unix) {
|
|
|
|
|
+
|
|
|
|
|
+ $dt = new DateTime($test->dts_start . " UTC");
|
|
|
|
|
+ $unix = $dt->format("U");
|
|
|
|
|
+
|
|
|
|
|
+ if($unix < $min_unix) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if($unix > $max_unix) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$empty_data = (object) [
|
|
$empty_data = (object) [
|
|
|
"label" => "",
|
|
"label" => "",
|
|
|
"testCount" => 0,
|
|
"testCount" => 0,
|
|
@@ -164,6 +217,7 @@ if($submit) {
|
|
|
"femaleTesterCount" => 0,
|
|
"femaleTesterCount" => 0,
|
|
|
"maleChallengerCount" => 0,
|
|
"maleChallengerCount" => 0,
|
|
|
"femaleChallengerCount" => 0,
|
|
"femaleChallengerCount" => 0,
|
|
|
|
|
+ "testCount" => 0,
|
|
|
"passCount" => 0,
|
|
"passCount" => 0,
|
|
|
"failCount" => 0,
|
|
"failCount" => 0,
|
|
|
|
|
|
|
@@ -275,6 +329,7 @@ if($submit) {
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $total_data->testCount++;
|
|
|
$data[$key]->testCount++;
|
|
$data[$key]->testCount++;
|
|
|
if($region) $region_data[$region][$key]->testCount++;
|
|
if($region) $region_data[$region][$key]->testCount++;
|
|
|
if($area_manager) $area_manager_data[$area_manager][$key]->testCount++;
|
|
if($area_manager) $area_manager_data[$area_manager][$key]->testCount++;
|
|
@@ -592,7 +647,7 @@ if($submit) {
|
|
|
|
|
|
|
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
-View::include("performance", compact("customer", "date_range", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data"));
|
|
|
|
|
|
|
+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"));
|
|
|
View::includeOnce("footer");
|
|
View::includeOnce("footer");
|
|
|
|
|
|
|
|
?>
|
|
?>
|