Hi, I have a report the is showing a teacher weekly schedule. in some of the cases the teachers are not working in all days so in order to include the missing days column I use the following process which you recommended
->pipe(new \koolreport\processes\Map(array(
"{end}" => function($count, $mapState) {
$emptyRows = [];
$days = [1, 2, 3, 4, 5, 6]; //use day name if it's your case
$emptyRows[] = ['day' => $key, 'hour_num' => $h_key];
return $emptyRows;
}
)))
I use Cube to make the days as columns and hour_num as row as follow:
->pipe(new Cube(array(
'row' => 'hour_num',
'column' => 'day',
'max' => 'class_name'
)))
The issue starts when a teacher does not have scheduled hours in a specific day or more and the process above add it as empty rows but in the end of the report. for instance Teacher works on Monday, Tuesday, Wednesday and Friday, On Sunday and Tuesday he is not scheduled. in the report with the above code it will show
Monday | Tuesday | Wednesday | Friday | Sunday | Thursday
I need it to be shown as the correct weekdays! btw, I used Sort process after the cube process but does not solve the problem.