From 06c19baf590d76e34af6aeaba3cb2ed08e4b614a Mon Sep 17 00:00:00 2001 From: Martin Lee Date: Fri, 28 Feb 2020 23:43:55 +0000 Subject: [PATCH] Fix FractionOddsToDecimal --- BritishHorseRacingApi.Tests/DataConverterHelperTests.cs | 1 + BritishHorseRacingApi/Helpers/DataConverterHelper.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BritishHorseRacingApi.Tests/DataConverterHelperTests.cs b/BritishHorseRacingApi.Tests/DataConverterHelperTests.cs index effbd0b..e594546 100644 --- a/BritishHorseRacingApi.Tests/DataConverterHelperTests.cs +++ b/BritishHorseRacingApi.Tests/DataConverterHelperTests.cs @@ -67,6 +67,7 @@ namespace BritishHorseRacingApi.Tests [Theory()] [InlineData("3/5", 1.6)] [InlineData("20/1",21)] + [InlineData("5.5/1", 6.5)] [InlineData("", null)] [InlineData(" ", null)] [InlineData(null, null)] diff --git a/BritishHorseRacingApi/Helpers/DataConverterHelper.cs b/BritishHorseRacingApi/Helpers/DataConverterHelper.cs index ba14e43..441e9e7 100644 --- a/BritishHorseRacingApi/Helpers/DataConverterHelper.cs +++ b/BritishHorseRacingApi/Helpers/DataConverterHelper.cs @@ -67,7 +67,7 @@ namespace BritishHorseRacingApi.Helpers var lossDifference = GetComponent(match, "lossDifference", 0d); return (int)TimeSpan.FromSeconds(lossDifference).TotalMilliseconds; } - private static Regex _ratioRegex = new Regex("(?'Numerator'[0-9]+)/(?'Denominator'[0-9]+)", RegexOptions.Compiled); + private static Regex _ratioRegex = new Regex("(?'Numerator'[0-9.]+)/(?'Denominator'[0-9.]+)", RegexOptions.Compiled); public static decimal? FractionOddsToDecimal(string fraction) { if (String.IsNullOrWhiteSpace(fraction))