[OCaml] High Intensity Training Online
fix Show recovery status in hours
Format the Home page recovery status as hours, with one decimal when needed, instead of exposing raw seconds to the user.
lib/web/handlers.ml
@@ -441,6 +441,13 @@
441
441
(Prescription.Routine.workouts r);
442
442
}
443
443
444
Added:
let duration_hours duration =
445
Added:
let hours =
446
Added:
float_of_int (Recovery.duration_to_seconds duration) /. 3600.
447
Added:
in
448
Added:
if Float.equal hours (Float.round hours) then Printf.sprintf "%.0fh" hours
449
Added:
else Printf.sprintf "%.1fh" hours
450
Added:
444
451
let home_view ~(routine : Repository.routine_id) ~routine_name ~next
445
452
~readiness : View_model.Home.t =
446
453
{
@@ -454,8 +461,8 @@
454
461
View_model.Home.Recovering
455
462
{
456
463
status =
457
Removed:
Format.asprintf "Recovery: %a of %a." Recovery.pp_duration
458
Removed:
rested Recovery.pp_duration recommended;
464
Added:
Printf.sprintf "Recovery: %s of %s." (duration_hours rested)
465
Added:
(duration_hours recommended);
459
466
});
460
467
}
461
468