Merge branch '409-add-analytics-for-forecasting' into 'master'
Limit rider schedule to 7 - 4 and 8 - 5 #409 Closes #409 See merge request jankstudio/resq!502
This commit is contained in:
commit
86122aa6e8
3 changed files with 61 additions and 23 deletions
|
|
@ -45,6 +45,7 @@ class AnalyticsController extends Controller
|
|||
];
|
||||
|
||||
protected $hour_shifts = [
|
||||
/*
|
||||
['00:00 - 09:00', 0, 1, 2, 3, 4, 5, 6, 7, 8],
|
||||
['01:00 - 10:00', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
['02:00 - 11:00', 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
|
|
@ -52,8 +53,10 @@ class AnalyticsController extends Controller
|
|||
['04:00 - 13:00', 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
||||
['05:00 - 14:00', 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
['06:00 - 15:00', 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
*/
|
||||
['07:00 - 16:00', 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
['08:00 - 17:00', 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
||||
/*
|
||||
['09:00 - 18:00', 9, 10, 11, 12, 13, 14, 15, 16, 17],
|
||||
['10:00 - 19:00', 10, 11, 12, 13, 14, 15, 16, 17, 18],
|
||||
['11:00 - 20:00', 11, 12, 13, 14, 15, 16, 17, 18, 19],
|
||||
|
|
@ -69,6 +72,7 @@ class AnalyticsController extends Controller
|
|||
['21:00 - 06:00', 21, 22, 23, 0, 1, 2, 3, 4, 5],
|
||||
['22:00 - 07:00', 22, 23, 0, 1, 2, 3, 4, 5, 6],
|
||||
['23:00 - 08:00', 23, 0, 1, 2, 3, 4, 5, 6, 7],
|
||||
*/
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -182,6 +186,7 @@ class AnalyticsController extends Controller
|
|||
|
||||
|
||||
// error_log(print_r($chart_all_weekdays, true));
|
||||
error_log(print_r($sched_res, true));
|
||||
|
||||
// agggregate weekday data
|
||||
$i = 0;
|
||||
|
|
@ -196,6 +201,7 @@ class AnalyticsController extends Controller
|
|||
$hub_data[$hub_id]['data_weekday'] = $chart_weekday;
|
||||
$hub_data[$hub_id]['data_all_weekdays'] = $chart_all_weekdays;
|
||||
$hub_data[$hub_id]['data_shift'] = $sched_res['weekday_shifts'];
|
||||
$hub_data[$hub_id]['shift_summary'] = $sched_res['shifts'];
|
||||
$hub_data[$hub_id]['total_jos'] = $total_jos;
|
||||
$hub_data[$hub_id]['total_riders'] = $sched_res['total_riders'];
|
||||
|
||||
|
|
@ -264,6 +270,7 @@ class AnalyticsController extends Controller
|
|||
|
||||
$res = $proc->getOutput();
|
||||
error_log($res);
|
||||
// returns lines with format: <day shift>-<hour shift>-<number of riders>
|
||||
|
||||
|
||||
// segregate into weekdays
|
||||
|
|
@ -298,6 +305,11 @@ class AnalyticsController extends Controller
|
|||
|
||||
$label = $this->day_shifts[$day_shift_index][0] . ' ' . $this->hour_shifts[$hour_shift_index][0];
|
||||
|
||||
$shifts[] = [
|
||||
'label' => $label,
|
||||
'count' => $rider_count,
|
||||
];
|
||||
|
||||
// initialize hours
|
||||
$rider_hours = [];
|
||||
for ($i = 0; $i < 24; $i++)
|
||||
|
|
@ -324,6 +336,7 @@ class AnalyticsController extends Controller
|
|||
|
||||
|
||||
$data = [
|
||||
'shifts' => $shifts,
|
||||
'weekday_shifts' => $day_data,
|
||||
'total_riders' => $total_riders,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% for hub in hub_list %}
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
|
|
@ -131,6 +133,29 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<table class="shift-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 350px;">Shift</th>
|
||||
<th style="width: 100px;"># Rider</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for shift_data in hub.shift_summary %}
|
||||
<tr>
|
||||
<td>{{ shift_data.label }}</td>
|
||||
<td>{{ shift_data.count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for day_data in hub.data_shift %}
|
||||
<div id="shift-table-{{ hub.id }}">
|
||||
<table class="shift-table">
|
||||
|
|
|
|||
|
|
@ -47,30 +47,30 @@ def main():
|
|||
|
||||
# all hour shifts available
|
||||
hour_shifts = [
|
||||
['00 - 09', 0, 1, 2, 3, 4, 5, 6, 7, 8],
|
||||
['01 - 10', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
['02 - 11', 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
['03 - 12', 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||
['04 - 13', 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
||||
['05 - 14', 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
['06 - 15', 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
#['00 - 09', 0, 1, 2, 3, 4, 5, 6, 7, 8],
|
||||
#['01 - 10', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
#['02 - 11', 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
#['03 - 12', 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||
#['04 - 13', 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
||||
#['05 - 14', 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
#['06 - 15', 6, 7, 8, 9, 10, 11, 12, 13, 14],
|
||||
['07 - 16', 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
['08 - 17', 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
||||
['09 - 18', 9, 10, 11, 12, 13, 14, 15, 16, 17],
|
||||
['10 - 19', 10, 11, 12, 13, 14, 15, 16, 17, 18],
|
||||
['11 - 20', 11, 12, 13, 14, 15, 16, 17, 18, 19],
|
||||
['12 - 21', 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
||||
['13 - 22', 13, 14, 15, 16, 17, 18, 19, 20, 21],
|
||||
['14 - 23', 14, 15, 16, 17, 18, 19, 20, 21, 22],
|
||||
['15 - 00', 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
||||
['16 - 01', 16, 17, 18, 19, 20, 21, 22, 23, 0],
|
||||
['17 - 02', 17, 18, 19, 20, 21, 22, 23, 0, 1],
|
||||
['18 - 03', 18, 19, 20, 21, 22, 23, 0, 1, 2],
|
||||
['19 - 04', 19, 20, 21, 22, 23, 0, 1, 2, 3],
|
||||
['20 - 05', 20, 21, 22, 23, 0, 1, 2, 3, 4],
|
||||
['21 - 06', 21, 22, 23, 0, 1, 2, 3, 4, 5],
|
||||
['22 - 07', 22, 23, 0, 1, 2, 3, 4, 5, 6],
|
||||
['23 - 08', 23, 0, 1, 2, 3, 4, 5, 6, 7]]
|
||||
['08 - 17', 8, 9, 10, 11, 12, 13, 14, 15, 16]]
|
||||
#['09 - 18', 9, 10, 11, 12, 13, 14, 15, 16, 17],
|
||||
#['10 - 19', 10, 11, 12, 13, 14, 15, 16, 17, 18],
|
||||
#['11 - 20', 11, 12, 13, 14, 15, 16, 17, 18, 19],
|
||||
#['12 - 21', 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
||||
#['13 - 22', 13, 14, 15, 16, 17, 18, 19, 20, 21],
|
||||
#['14 - 23', 14, 15, 16, 17, 18, 19, 20, 21, 22],
|
||||
#['15 - 00', 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
||||
#['16 - 01', 16, 17, 18, 19, 20, 21, 22, 23, 0],
|
||||
#['17 - 02', 17, 18, 19, 20, 21, 22, 23, 0, 1],
|
||||
#['18 - 03', 18, 19, 20, 21, 22, 23, 0, 1, 2],
|
||||
#['19 - 04', 19, 20, 21, 22, 23, 0, 1, 2, 3],
|
||||
#['20 - 05', 20, 21, 22, 23, 0, 1, 2, 3, 4],
|
||||
#['21 - 06', 21, 22, 23, 0, 1, 2, 3, 4, 5],
|
||||
#['22 - 07', 22, 23, 0, 1, 2, 3, 4, 5, 6],
|
||||
#['23 - 08', 23, 0, 1, 2, 3, 4, 5, 6, 7]]
|
||||
|
||||
# all possible days riders come in
|
||||
day_shifts = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue