Это мой sql запрос
SELECT WEEKDAY(C.created_date) as date_label, COUNT(C.consignment_id) as deliveries, C.service_id, CS.display_name
FROM (`consignments` as C)
LEFT JOIN `courier_service` as CS ON `CS`.`id`=`C`.`service_id`
WHERE `C`.`org_id` = 165
AND (created_date >= '2017-06-25' AND created_date <= '2017-12-13')
AND `C`.`is_deleted` = 0
AND `C`.`is_service_assigned` = 1
GROUP BY `date_label`, `C`.`service_id`
Я создаю график с графиками. Что я должен сделать, чтобы сопоставить данные в моем контроллере php, чтобы у [0], который является понедельником, было 3 доставки?
Мой php код
$label = array();
$weektrendlist = array();
foreach($services as $service) {
$listname = array("0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0);
$weektrendinfobyservice = $this->overall_reports_model-> overall_performance_week_trend_per_service($service->service_id, $start_date, $end_date, $org_id);
foreach($weektrendinfobyservice as $row) {
$listname[$row->date_label] = $row->deliveries;
}
$dataset = array();
$dataset['name'] = $service->display_name;
$hash = md5($service->service_id.$service->service_name);
$dataset['data'] = array_values($listname);
$weektrendlist[] = $dataset;
}
$result['weektrend'] = array(
"label" => array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
"datasets" => $weektrendlist
);
Задача ещё не решена.
Других решений пока нет …