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.

Commit
25847ebdf221b75649827b06e0868a7878a75d47
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
lib/web/handlers.ml
index 34cbee69..a819b419 100644..100644
@@ -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