Fixed sleep tracking not working
This commit is contained in:
parent
790ed4a7ae
commit
ce6fec6823
1 changed files with 7 additions and 2 deletions
|
@ -75,8 +75,13 @@ loadGivenParameters($activity);
|
||||||
storeActivity($activity);
|
storeActivity($activity);
|
||||||
|
|
||||||
// Handle sleep streak
|
// Handle sleep streak
|
||||||
$startingHour = (int) date("H");
|
$tz = 'Europe/Berlin';
|
||||||
if ($activity->title == "Sleeping" && $startingHour > 18) {
|
$timestamp = $activity->startTime;
|
||||||
|
$dt = new DateTime("now", new DateTimeZone($tz)); //first argument "must" be a string
|
||||||
|
$dt->setTimestamp($timestamp); //adjust the object to correct timestamp
|
||||||
|
|
||||||
|
$startingHour = (int) $dt->format('H');
|
||||||
|
if ($activity->template == "sleeping" && $startingHour > 18) {
|
||||||
markTodayAsSuccess("sleep");
|
markTodayAsSuccess("sleep");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue