fix grouping logic

master
root 2 years ago
parent 0a50822679
commit d0261bb713

@ -74,7 +74,7 @@ foreach ($data->list as $line) {
$rainArr = (array) ($line->rain ?? []); $rainArr = (array) ($line->rain ?? []);
$snowArr = (array) ($line->snow ?? []); $snowArr = (array) ($line->snow ?? []);
$rain = ($rainArr['3h'] ?? 0) + ($snowArr['3h'] ?? 0); $rain = ($rainArr['3h'] ?? 0) + ($snowArr['3h'] ?? 0);
$wind = $line->wind->speed; $wind = $line->wind->speed;
$flying = $rain === 0 && $wind < 2.5 ? 'Y' $flying = $rain === 0 && $wind < 2.5 ? 'Y'
: $rain <= 0.3 && $wind < 3.1 ? 'M' : $rain <= 0.3 && $wind < 3.1 ? 'M'
@ -112,7 +112,7 @@ foreach($list as $line) {
$dayGroup[] = $line; $dayGroup[] = $line;
} else { } else {
$grouped[] = $dayGroup; $grouped[] = $dayGroup;
$dayGroup = []; $dayGroup = [$line];
$lastDay = $dayStr; $lastDay = $dayStr;
} }
} }

Loading…
Cancel
Save