{
foreach ($this->actualQuery as $key => $actualRow) {
$key < 5 ? Log::info('beg: ' . $addingField . ' : ' . Carbon::now()->format(DATE_RFC3339_EXTENDED)) : false;
$foundRow = $pastData
->where('commodity', $actualRow['commodity'])
->where('quality', $actualRow['quality'])
->where('country', $actualRow['country'])
->where('port', $actualRow['port'])
->where('condition', $actualRow['condition'])
->where('currency', $actualRow['currency'])
->where('month_num', $actualRow['month_num'])
->first();
if ($foundRow) {
$this->actualQuery[$key][$addingField] = $actualRow['seller_avg'] - $foundRow->seller_avg;
}
else {
$this->actualQuery[$key][$addingField] = -777.777;
Log::info($actualRow);
}
$key < 5 ? Log::info('end: ' . $addingField . ' : ' . Carbon::now()->format(DATE_RFC3339_EXTENDED)) : false;
}
}
ожидаемо, что в Логи он внесет 10 строк - в начале и в конце первых 5-ти итераций.
но в логе вижу 20 строк:
[2021-11-10 19:52:36] local.INFO: beg: day_diff : 2021-11-10T19:52:36.892+00:00
[2021-11-10 19:52:36] local.INFO: end: day_diff : 2021-11-10T19:52:36.936+00:00
[2021-11-10 19:52:36] local.INFO: beg: day_diff : 2021-11-10T19:52:36.936+00:00
[2021-11-10 19:52:36] local.INFO: end: day_diff : 2021-11-10T19:52:36.967+00:00
[2021-11-10 19:52:36] local.INFO: beg: day_diff : 2021-11-10T19:52:36.968+00:00
[2021-11-10 19:52:37] local.INFO: end: day_diff : 2021-11-10T19:52:37.000+00:00
[2021-11-10 19:52:37] local.INFO: beg: day_diff : 2021-11-10T19:52:37.000+00:00
[2021-11-10 19:52:37] local.INFO: end: day_diff : 2021-11-10T19:52:37.031+00:00
[2021-11-10 19:52:37] local.INFO: beg: day_diff : 2021-11-10T19:52:37.032+00:00
[2021-11-10 19:52:37] local.INFO: end: day_diff : 2021-11-10T19:52:37.063+00:00
[2021-11-10 19:52:51] local.INFO: beg: day_diff : 2021-11-10T19:52:51.617+00:00
[2021-11-10 19:52:51] local.INFO: end: day_diff : 2021-11-10T19:52:51.667+00:00
[2021-11-10 19:52:51] local.INFO: beg: day_diff : 2021-11-10T19:52:51.668+00:00
[2021-11-10 19:52:51] local.INFO: end: day_diff : 2021-11-10T19:52:51.708+00:00
[2021-11-10 19:52:51] local.INFO: beg: day_diff : 2021-11-10T19:52:51.709+00:00
[2021-11-10 19:52:51] local.INFO: end: day_diff : 2021-11-10T19:52:51.749+00:00
[2021-11-10 19:52:51] local.INFO: beg: day_diff : 2021-11-10T19:52:51.750+00:00
[2021-11-10 19:52:51] local.INFO: end: day_diff : 2021-11-10T19:52:51.787+00:00
[2021-11-10 19:52:51] local.INFO: beg: day_diff : 2021-11-10T19:52:51.787+00:00
[2021-11-10 19:52:51] local.INFO: end: day_diff : 2021-11-10T19:52:51.822+00:00
посоветуйте плз - как продебажить?
чтобы понять - почему цикл или метод выполняется 2 раза?
$this->actualQuery содержит два элемента массива?
Я разобрался. Оказывается это метод вызывали 2 контроллера подряд! Рефакторю :)
:) не до этого сейчас
Обсуждают сегодня