You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Sessions.duration field is saved in integer seconds. In order to be human readable, it needs to be converted to h:mm:ss format with:
(new FrozenTime($session->duration))->format('G:i:s')
It might happen that it has a null value. In this case, we need not to show a value (or show 0:00:00 at least). Without conversion, this null value will make FrozenTime constructor create a current timestamp value, which is not the goal here. This is solved like that:
isset($session->duration) ? (new FrozenTime($session->duration))->format('G:i:s') : ''
This conversion is done, right now, on the View layer, in many template files.
It would be more coherent, efficient and error-proof to get the final value right from the Model layer. With the only exception of model methods where we need to take the value to calculate with it. Anyway, right now the field is only summed inside custom finders, so since we take the value, we only need to pass it to the View.
TO DO: study the best way to achieve this, being it using a Behavior or other.
The text was updated successfully, but these errors were encountered:
The Sessions.duration field is saved in integer seconds. In order to be human readable, it needs to be converted to h:mm:ss format with:
It might happen that it has a
null
value. In this case, we need not to show a value (or show0:00:00
at least). Without conversion, thisnull
value will make FrozenTime constructor create a current timestamp value, which is not the goal here. This is solved like that:This conversion is done, right now, on the View layer, in many template files.
It would be more coherent, efficient and error-proof to get the final value right from the Model layer. With the only exception of model methods where we need to take the value to calculate with it. Anyway, right now the field is only summed inside custom finders, so since we take the value, we only need to pass it to the View.
TO DO: study the best way to achieve this, being it using a Behavior or other.
The text was updated successfully, but these errors were encountered: