| |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |
---|
| | $streak = 0; |
---|
| | $thisWeek = date('Y-W'); // Get the current week |
---|
| | |
---|
| | while (isset($weeklyOccurrences[$thisWeek]) && $weeklyOccurrences[$thisWeek] >= $multiplier) { |
---|
| | $streak++; |
---|
| | $thisWeek = date('Y-W', strtotime($thisWeek . ' -1 week')); |
---|
| | } |
---|
| | $consecutiveCount = 0; |
---|
| | $maxConsecutiveCount = 0; |
---|
| | |
---|
| | ksort($weeklyOccurrences); |
---|
| | |
---|
| | foreach ($weeklyOccurrences as $week => $value) { |
---|
| | if ($value >= 2) { |
---|
| | $consecutiveCount++; |
---|
| | $maxConsecutiveCount = max($maxConsecutiveCount, $consecutiveCount); |
---|
| | } else { |
---|
| | $consecutiveCount = 0; // Reset count if the value is less than 2 |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | //print_r($dateOccurrences); |
---|
| | //print_r($weeklyOccurrences); |
---|
| | |
---|
| | return $streak; |
---|
| | return $consecutiveCount; |
---|
| | } |
---|
| | |
---|
| | function habit_get_stat_missed($word, $filename) { |
---|
| | // Split the file content into an array of lines |
---|
| |
---|
| | |