Euromillions was looking at lotto table rather than euro one.

This commit is contained in:
2024-02-15 19:23:27 +00:00
parent e2ec108b0d
commit fc86c91b01
3 changed files with 14 additions and 12 deletions

View File

@@ -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<int>? 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<int> 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<int>? 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<int> balls && balls.Count >= 2)
{

View File

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

View File

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