From fc86c91b01e35493a61d5dac751bf021d9a609b1 Mon Sep 17 00:00:00 2001 From: Ross Healy Date: Thu, 15 Feb 2024 19:23:27 +0000 Subject: [PATCH] Euromillions was looking at lotto table rather than euro one. --- .../EuroMillions/DrawBalls.cs | 18 +++++++++--------- .../EuroMillions/DrawWinnerInformation.cs | 2 ++ .../NationalLottery/DrawBalls.cs | 6 +++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lottery-co-uk-scraper/EuroMillions/DrawBalls.cs b/lottery-co-uk-scraper/EuroMillions/DrawBalls.cs index ee4605a..68b653b 100644 --- a/lottery-co-uk-scraper/EuroMillions/DrawBalls.cs +++ b/lottery-co-uk-scraper/EuroMillions/DrawBalls.cs @@ -2,7 +2,7 @@ using lottery_co_uk_scraper.core.Models; using lottery_co_uk_scraper.Utilities; using Microsoft.Extensions.Logging; -using static lottery_co_uk_scraper.NationalLottery.Lotto; +using static lottery_co_uk_scraper.EuroMillions.DrawWinnerInformation; /// So this table should not exist here. namespace lottery_co_uk_scraper.EuroMillions { @@ -35,7 +35,7 @@ namespace lottery_co_uk_scraper.EuroMillions if (int.TryParse(ballSetUsedString, out int ballSetUsed)) { - AssignBallSetToModelProperty(LotteryTableRow.BallSetUsed, ballSetUsed, eurosResult); + AssignBallSetToModelProperty(EurosTableRow.BallSetUsed, ballSetUsed, eurosResult); return ballSetUsed; } @@ -56,7 +56,7 @@ namespace lottery_co_uk_scraper.EuroMillions { try { - if (containerNode == LotteryTableRow.BallSetUsed) + if (containerNode == EurosTableRow.BallSetUsed) { PropertyManager.SetProperty(nameof(eurosResult.BallSetUsed), eurosResult, ballSetUsed); } @@ -73,7 +73,7 @@ namespace lottery_co_uk_scraper.EuroMillions { try { - var ballsDrawn = GetNodeById(doc.DocumentNode, LotteryTableRow.BallsDrawn); + var ballsDrawn = GetNodeById(doc.DocumentNode, EurosTableRow.BallsDrawn); List? euroBalls = ballsDrawn != null ? ExtractBalls(ballsDrawn, "euromillions-ball") @@ -81,7 +81,7 @@ namespace lottery_co_uk_scraper.EuroMillions if (euroBalls != null) { - AssignDrawBallsToModelProperty(LotteryTableRow.BallsDrawn, euroBalls, eurosResult); + AssignDrawBallsToModelProperty(EurosTableRow.BallsDrawn, euroBalls, eurosResult); } else { @@ -127,7 +127,7 @@ namespace lottery_co_uk_scraper.EuroMillions { try { - if (containerNode == LotteryTableRow.BallsDrawn) + if (containerNode == EurosTableRow.BallsDrawn) { if (ballInformation is List balls && balls.Count >= 5) { @@ -161,7 +161,7 @@ namespace lottery_co_uk_scraper.EuroMillions { try { - var ballsDrawn = GetNodeById(doc.DocumentNode, LotteryTableRow.BallsDrawn); + var ballsDrawn = GetNodeById(doc.DocumentNode, EurosTableRow.BallsDrawn); List? luckyStars = ballsDrawn != null ? ExtractLuckyStar(ballsDrawn, "euromillions-lucky-star") @@ -169,7 +169,7 @@ namespace lottery_co_uk_scraper.EuroMillions if (luckyStars != null) { - AssignLuckyStarToModelProperty(LotteryTableRow.BallsDrawn, luckyStars, eurosResult); + AssignLuckyStarToModelProperty(EurosTableRow.BallsDrawn, luckyStars, eurosResult); } else { @@ -218,7 +218,7 @@ namespace lottery_co_uk_scraper.EuroMillions { try { - if (containerNode == LotteryTableRow.BallsDrawn) + if (containerNode == EurosTableRow.BallsDrawn) { if (ballInformation is List balls && balls.Count >= 2) { diff --git a/lottery-co-uk-scraper/EuroMillions/DrawWinnerInformation.cs b/lottery-co-uk-scraper/EuroMillions/DrawWinnerInformation.cs index 87960a5..0b11114 100644 --- a/lottery-co-uk-scraper/EuroMillions/DrawWinnerInformation.cs +++ b/lottery-co-uk-scraper/EuroMillions/DrawWinnerInformation.cs @@ -14,6 +14,8 @@ namespace lottery_co_uk_scraper.EuroMillions internal class EurosTableRow() { + internal const string BallSetUsed = "ballSetUsed"; + internal const string BallsDrawn = "ballsDrawn"; internal const string Match1Plus2Stars = "Match 1 and 2 Stars"; internal const string Match2 = "Match 2"; internal const string Match2Plus1Star = "Match 2 and 1 Star"; diff --git a/lottery-co-uk-scraper/NationalLottery/DrawBalls.cs b/lottery-co-uk-scraper/NationalLottery/DrawBalls.cs index 61418c1..8c573f9 100644 --- a/lottery-co-uk-scraper/NationalLottery/DrawBalls.cs +++ b/lottery-co-uk-scraper/NationalLottery/DrawBalls.cs @@ -2,7 +2,7 @@ using lottery_co_uk_scraper.core.Models; using lottery_co_uk_scraper.Utilities; using Microsoft.Extensions.Logging; -using static lottery_co_uk_scraper.NationalLottery.Lotto; +using static lottery_co_uk_scraper.NationalLottery.DrawWinnerInformation; namespace lottery_co_uk_scraper.NationalLottery { @@ -176,9 +176,9 @@ namespace lottery_co_uk_scraper.NationalLottery } else { - _logger.LogError("Bonus Ball appear to be null."); + _logger.LogError("Bonus Ball appears to be null."); - throw new Exception("Bonus Ballappear to be null."); + throw new Exception("Bonus Ball appears to be null."); } } catch (Exception ex)