From 1a821706e27a2f5929625a1f752edd674800f761 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Mon, 3 Sep 2018 20:52:13 -0500 Subject: [PATCH] Implement forgotten imperial measurement for Height field --- AuroraRecordGenerator/RecordFormatterGenerationMethods.cs | 2 +- AuroraRecordGenerator/Utility.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs b/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs index 5c9a2c9..a0d7576 100644 --- a/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs +++ b/AuroraRecordGenerator/RecordFormatterGenerationMethods.cs @@ -24,7 +24,7 @@ namespace AuroraRecordGenerator record.AppendLine($"Clearance Level: {_targetRecord.Clearance.IfEmpty("Not Specified")}"); record.AppendLine($"Employed As: {_targetRecord.EmployedAs.IfEmpty("Assistant")}"); if (_targetRecord.CharHeight != null) - record.AppendLine($"Height: {_targetRecord.CharHeight} cm");// ({Utility.CmToFeet(_targetRecord.CharHeight.Value)}) + record.AppendLine($"Height: {_targetRecord.CharHeight} cm ({Utility.CmToFeet(_targetRecord.CharHeight.Value)})"); if (_targetRecord.Weight != null) record.AppendLine($"Weight: {_targetRecord.Weight} kg ({Utility.KgToLb(_targetRecord.Weight ?? 0)} lb)"); diff --git a/AuroraRecordGenerator/Utility.cs b/AuroraRecordGenerator/Utility.cs index 2d4f013..2503d1d 100644 --- a/AuroraRecordGenerator/Utility.cs +++ b/AuroraRecordGenerator/Utility.cs @@ -13,7 +13,10 @@ namespace AuroraRecordGenerator public static string CmToFeet(double cm) { - return "0'0\""; + var feet = Math.Floor(cm * 0.0328084); + var inches = Math.Floor(cm * 0.39370079); // Isn't imperial a lovely system? + inches -= feet * 12; + return $"{feet}'{inches}\""; } ///