diff --git a/src/Controller/AnalyticsController.php b/src/Controller/AnalyticsController.php index f78cbcf4..017333e5 100644 --- a/src/Controller/AnalyticsController.php +++ b/src/Controller/AnalyticsController.php @@ -128,6 +128,17 @@ class AnalyticsController extends Controller ]; } + // init aggregate information + $agg_data = []; + for ($i = 0; $i < 7; $i++) + { + $agg_data[] = [ + 'label' => $this->weekdays[$i], + 'total_jos' => 0, + 'total_riders' => 0, + ]; + } + // reprocess weekday data to account for overlap foreach ($hub_data as $hub_id => $one_hub) { @@ -162,6 +173,15 @@ class AnalyticsController extends Controller ]; } + // agggregate weekday data + $i = 0; + foreach ($sched_res['weekday_shifts'] as $day_data) + { + $agg_data[$i]['total_jos'] += $day_data['total_jos']; + $agg_data[$i]['total_riders'] += $day_data['total_riders']; + $i++; + } + $hub_data[$hub_id]['data_weekday'] = $chart_weekday; $hub_data[$hub_id]['data_all_weekdays'] = $chart_all_weekdays; @@ -177,11 +197,14 @@ class AnalyticsController extends Controller // get job orders not covered by hubs $not_covered = $this->generateNotCoveredData($em, $hub_coverage, $today); + // error_log(print_r($agg_data, true)); + $params = [ 'date' => $today, 'hub_list' => $hub_data, 'hub_coverage' => $hub_coverage, 'not_covered' => $not_covered, + 'agg_data' => $agg_data, ]; return $this->render('analytics/forecast_submit.html.twig', $params); @@ -219,7 +242,7 @@ class AnalyticsController extends Controller foreach ($scheduler_data as $weekday_data) $args[] = implode('-', $weekday_data); - error_log(print_r($args, true)); + // error_log(print_r($args, true)); // error_log('running...' . $sched_script); @@ -230,7 +253,7 @@ class AnalyticsController extends Controller error_log('SCHEDULER DID NOT RUN PROPERLY'); $res = $proc->getOutput(); - error_log($res); + // error_log($res); // segregate into weekdays @@ -272,7 +295,7 @@ class AnalyticsController extends Controller for ($i = 1; $i < count($this->hour_shifts[$hour_shift_index]); $i++) $rider_hours[$this->hour_shifts[$hour_shift_index][$i]] = 1; - error_log('allocating ' . $rider_count . ' for ' . $label); + // error_log('allocating ' . $rider_count . ' for ' . $label); // add shifts to the weekday for ($i = 1; $i < count($this->day_shifts[$day_shift_index]); $i++) diff --git a/templates/analytics/forecast_submit.html.twig b/templates/analytics/forecast_submit.html.twig index 937fb659..d884bc15 100644 --- a/templates/analytics/forecast_submit.html.twig +++ b/templates/analytics/forecast_submit.html.twig @@ -39,6 +39,37 @@
+
+
+
+ + + + + + + + + + + {% for i in 0..6 %} + + + + + {% if agg_data[i].total_riders == 0 %} + + {% else %} + + {% endif %} + + {% endfor %} + +
Day# JO# RiderJO per Rider
{{ agg_data[i].label }}{{ agg_data[i].total_jos }}{{ agg_data[i].total_riders }}0{{ (agg_data[i].total_jos / agg_data[i].total_riders) | round(1, 'common') }}
+
+
+
+ {% for hub in hub_list %}
@@ -65,6 +96,41 @@
+ + + + + + + + + + + {% for i in 0..6 %} + + + + + {% if hub.data_shift[i].total_riders == 0 %} + + {% else %} + + {% endif %} + + {% endfor %} + + + + + {% if hub.total_riders == 0 %} + + {% else %} + + {% endif %} + + +
Day# JO# RiderJO per Rider
{{ hub.data_shift[i].weekday }}{{ hub.data_shift[i].total_jos }}{{ hub.data_shift[i].total_riders }}0{{ (hub.data_shift[i].total_jos / hub.data_shift[i].total_riders) | round(1, 'common') }}
Overall{{ hub.total_jos }}{{ hub.total_riders }}0{{ (hub.total_jos / hub.total_riders) | round(1, 'common') }}
+ {% for day_data in hub.data_shift %}
@@ -116,40 +182,6 @@
{% endfor %} - - - - - - - - - - - {% for i in 0..6 %} - - - - - {% if hub.data_shift[i].total_riders == 0 %} - - {% else %} - - {% endif %} - - {% endfor %} - - - - - {% if hub.total_riders == 0 %} - - {% else %} - - {% endif %} - - -
Day# JO# RiderJO per Rider
{{ hub.data_shift[i].weekday }}{{ hub.data_shift[i].total_jos }}{{ hub.data_shift[i].total_riders }}0{{ (hub.data_shift[i].total_jos / hub.data_shift[i].total_riders) | round(1, 'common') }}
Overall{{ hub.total_jos }}{{ hub.total_riders }}0{{ (hub.total_jos / hub.total_riders) | round(1, 'common') }}