Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * ak klient ma stale platny program cviceni, nastavi sa mu cviciaci tyzden
- */
- $todayDatetime = \Nette\Utils\DateTime::from('now');
- $mainDatetime = \Nette\Utils\DateTime::from($lastQuestionnaire->created);
- if ($todayDatetime === $mainDatetime) {
- $currentExcerciseWeek = 1;
- } else {
- $currentExcerciseWeek = $todayDatetime->diff($mainDatetime, TRUE);
- $currentExcerciseWeek = $currentExcerciseWeek->format('%a');
- $currentExcerciseWeek = ceil($currentExcerciseWeek / 7);
- $currentExcerciseWeek = intval($currentExcerciseWeek);
- }
- if ($currentExcerciseWeek === 0) {
- $currentExcerciseWeek = 1;
- }
- /**
- * ak ma klient viac dotaznikov,
- * zapocita sa mu do aktualneho tyzdna dlzka z minulych programov
- */
- $previosProgramLength = 0;
- if (count($questionnaires) > 1) {
- for ($i = 1; $i < count($questionnaires); $i++) {
- //v tyzdnoch
- $previosProgramLength = $questionnaires[$i]->product->excerciseDuration * 4;
- $currentExcerciseWeek += $previosProgramLength;
- }
- }
- if (!empty($client->excercisePauseDuration)) {
- $currentExcerciseWeek = $currentExcerciseWeek - floor($client->excercisePauseDuration / 7);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement