I'm working on a sport analytic platform,I'm using Laravel
framework .
I have a WORKOUT
table as follows
| workoutDay |TSS|
| ---------- |---|
| 2020-10-01 | 20|
| 2020-10-10 | 50|
| 2020-10-15 | 30|
so we will have an array from select query :
$tssData= [
[2020-10-01,20],
[2020-10-10,50],
[2020-10-15,30],
]
I also have a formula for calculating athlete's fitness which is recursive
$count = count($tssData);
$fitness[] = 0;
$result= [];
for ($i = 1; $i < $count + 1; $i++) {
$result[] = [
$workoutDay[] = $tssData[$i - 1][0],
$fitness[] = $fitness[$i - 1] + (($tssData[$i - 1][1] - $fitness[$i - 1]) / 7),
}
return $result;
}
I need to calculate the fitness for everyday in a row even for those date which are not available in the table
I think if we can fill the array with the missed date it works but how :
$tssData= [
[2020-10-01,20],
[2020-10-02,0],
[2020-10-03,0],
... ,
[2020-10-10,50],
[2020-10-11,0],
[2020-10-12,0],
[2020-10-13,0],
.... ,
[2020-10-15,30],
]
and I don't think it would be a proper solution to add all days one after one in the db table with 0 TSS.