From 5fa723a3e13498e4e71f9d75ddcc54b2dd74fef4 Mon Sep 17 00:00:00 2001 From: Anton Veselev Date: Sun, 7 Jul 2024 03:04:58 +0100 Subject: [PATCH] fix h/a --- .../getFirstSuitableMatchday.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts b/src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts index 37822744..68a51d7e 100644 --- a/src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts +++ b/src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts @@ -111,16 +111,16 @@ export default ({ ) { return true; } - } else if (c.pickedMatchday >= numMatchdays - 2) { - // is last two - if ( - c.locationByMatchday[ - `${t}:${numMatchdays * 2 - 3 - c.pickedMatchday}` - ] === loc - ) { - return true; - } - } else { + } else if ( + c.pickedMatchday >= numMatchdays - 2 && // is last two + c.locationByMatchday[ + `${t}:${numMatchdays * 2 - 3 - c.pickedMatchday}` + ] === loc + ) { + return true; + } + + if (c.pickedMatchday > 0 && c.pickedMatchday < numMatchdays - 1) { const minus1 = c.locationByMatchday[`${t}:${c.pickedMatchday - 1}`]; const plus1 = @@ -134,10 +134,10 @@ export default ({ if (minus2 === loc) { return true; } - } else { + } else if (plus1 === loc) { const plus2 = c.locationByMatchday[`${t}:${c.pickedMatchday + 2}`]; - if (plus1 === loc && plus2 === loc) { + if (plus2 === loc) { return true; } }