->andWhere(['date_shift' => $plan->date])
->andWhere(['admin_id' => $plan->admin_id])
->andWhere(['store_id' => $plan->store_id])
+ ->orderBy('id asc')
->all();
if (sizeof($facts) > 1) {
$start->setAttribute('date_end', $end->date_start);
$start->setAttribute('time_end', $end->time_start);
$start->setAttribute('checkin_end_id', $end->checkin_start_id);
+ $start->setAttribute('work_time', min(abs(strtotime($end->date_start . $end->time_start) + 600 - strtotime($start->date_start . $start->time_start)) / 3600, TimetableFactModel::WORK_HOURS_TIME));
$start->setAttribute('autoclosed', 0);
$start->save();
$end->delete();