Deal with total people suffix #2

Merged
patrick merged 1 commits from deal-with-suffix into main 2023-10-21 00:39:55 +00:00
Showing only changes of commit e682596dc0 - Show all commits

View File

@@ -177,6 +177,7 @@ type GymAttendance =
/// How many people are in classes at the gym as of this statistics snapshot /// How many people are in classes at the gym as of this statistics snapshot
[<JsonRequired>] [<JsonRequired>]
TotalPeopleInClasses : int TotalPeopleInClasses : int
/// E.g. " or fewer"
TotalPeopleSuffix : string TotalPeopleSuffix : string
[<JsonRequired>] [<JsonRequired>]
IsApproximate : bool IsApproximate : bool
@@ -192,8 +193,10 @@ type GymAttendance =
/// Human-readable representation /// Human-readable representation
override this.ToString () = override this.ToString () =
if not (Object.ReferenceEquals (this.TotalPeopleSuffix, null)) then let totalPeopleSuffix =
failwith $"Unexpectedly got Total People Suffix: %s{this.TotalPeopleSuffix}" match this.TotalPeopleSuffix with
| null -> ""
| suffix -> suffix
let capacity = let capacity =
if this.MaximumCapacity = 0 then if this.MaximumCapacity = 0 then
@@ -207,7 +210,7 @@ type GymAttendance =
else else
$"\n%i{this.TotalPeopleInClasses} in classes" $"\n%i{this.TotalPeopleInClasses} in classes"
$"""%i{this.TotalPeopleInGym} in gym%s{capacity} (is exact: %c{Char.emoji (not this.IsApproximate)})%s{classes} $"""%i{this.TotalPeopleInGym}%s{totalPeopleSuffix} in gym%s{capacity} (is exact: %c{Char.emoji (not this.IsApproximate)})%s{classes}
Query made at %s{this.AttendanceTime.ToString "s"}%s{this.AttendanceTime.ToString "zzz"} Query made at %s{this.AttendanceTime.ToString "s"}%s{this.AttendanceTime.ToString "zzz"}
Snapshot correct as of %s{this.LastRefreshed.ToString "s"}%s{this.LastRefreshed.ToString "zzz"} Snapshot correct as of %s{this.LastRefreshed.ToString "s"}%s{this.LastRefreshed.ToString "zzz"}
Classes info correct as of %s{this.LastRefreshedPeopleInClasses.ToString "s"}%s{this.LastRefreshedPeopleInClasses.ToString "zzz"}""" Classes info correct as of %s{this.LastRefreshedPeopleInClasses.ToString "s"}%s{this.LastRefreshedPeopleInClasses.ToString "zzz"}"""