Implement forgotten imperial measurement for Height field

This commit is contained in:
Lohikar 2018-09-03 20:52:13 -05:00
parent 513adb71fd
commit 1a821706e2
2 changed files with 5 additions and 2 deletions

View file

@ -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)");

View file

@ -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}\"";
}
/// <summary>