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
[<JsonRequired>]
TotalPeopleInClasses : int
/// E.g. " or fewer"
TotalPeopleSuffix : string
[<JsonRequired>]
IsApproximate : bool
@@ -192,8 +193,10 @@ type GymAttendance =
/// Human-readable representation
override this.ToString () =
if not (Object.ReferenceEquals (this.TotalPeopleSuffix, null)) then
failwith $"Unexpectedly got Total People Suffix: %s{this.TotalPeopleSuffix}"
let totalPeopleSuffix =
match this.TotalPeopleSuffix with
| null -> ""
| suffix -> suffix
let capacity =
if this.MaximumCapacity = 0 then
@@ -207,7 +210,7 @@ type GymAttendance =
else
$"\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"}
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"}"""