fix: [decaying:simulation] Make sure every sightings have a rounded

timestamp
pull/5032/head
mokaddem 2019-09-12 12:54:38 +02:00
parent fbad1aaff3
commit 5322527c65
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 4 deletions

View File

@ -449,10 +449,9 @@ class DecayingModel extends AppModel
$sightings = $this->Sighting->listSightings($user, $attribute_id, 'attribute', false, 0, false);
if (empty($sightings)) {
$sightings = array(array('Sighting' => array('date_sighting' => $attribute['Attribute']['timestamp']))); // simulate a Sighting nonetheless
} else {
foreach ($sightings as $i => $sighting) {
$sightings[$i]['Sighting']['rounded_timestamp'] = $this->round_timestamp_to_hour($sighting['Sighting']['date_sighting']);
}
}
foreach ($sightings as $i => $sighting) {
$sightings[$i]['Sighting']['rounded_timestamp'] = $this->round_timestamp_to_hour($sighting['Sighting']['date_sighting']);
}
// get start time
$start_time = $attribute['Attribute']['timestamp'];