Skip to content

Commit 7f59e26

Browse files
committed
fix
1 parent 1bd6006 commit 7f59e26

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

Diff for: src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts

+35-35
Original file line numberDiff line numberDiff line change
@@ -97,41 +97,41 @@ export default ({
9797
return true;
9898
}
9999

100-
// for (let b = 0; b < 2; ++b) {
101-
// const loc = b === 0 ? 'h' : 'a';
102-
// const t = b === 0 ? h : a;
103-
104-
// if (md <= 1) {
105-
// // is first two
106-
// if (c.locationByMatchday[`${t}:${1 - md}`] === loc) {
107-
// return true;
108-
// }
109-
// } else if (
110-
// md >= numMatchdays - 2 && // is last two
111-
// c.locationByMatchday[`${t}:${numMatchdays * 2 - 3 - md}`] === loc
112-
// ) {
113-
// return true;
114-
// }
115-
116-
// if (md > 0 && md < numMatchdays - 1) {
117-
// const minus1 = c.locationByMatchday[`${t}:${md - 1}`];
118-
// const plus1 = c.locationByMatchday[`${t}:${md + 1}`];
119-
// if (minus1 === loc) {
120-
// if (plus1 === loc) {
121-
// return true;
122-
// }
123-
// const minus2 = c.locationByMatchday[`${t}:${md - 2}`];
124-
// if (minus2 === loc) {
125-
// return true;
126-
// }
127-
// } else if (plus1 === loc) {
128-
// const plus2 = c.locationByMatchday[`${t}:${md + 2}`];
129-
// if (plus2 === loc) {
130-
// return true;
131-
// }
132-
// }
133-
// }
134-
// }
100+
for (let b = 0; b < 2; ++b) {
101+
const loc = b === 0 ? 'h' : 'a';
102+
const t = b === 0 ? h : a;
103+
104+
if (md <= 1) {
105+
// is first two
106+
if (c.locationByMatchday[`${t}:${1 - md}`] === loc) {
107+
return true;
108+
}
109+
} else if (
110+
md >= numMatchdays - 2 && // is last two
111+
c.locationByMatchday[`${t}:${numMatchdays * 2 - 3 - md}`] === loc
112+
) {
113+
return true;
114+
}
115+
116+
if (md > 0 && md < numMatchdays - 1) {
117+
const minus1 = c.locationByMatchday[`${t}:${md - 1}`];
118+
const plus1 = c.locationByMatchday[`${t}:${md + 1}`];
119+
if (minus1 === loc) {
120+
if (plus1 === loc) {
121+
return true;
122+
}
123+
const minus2 = c.locationByMatchday[`${t}:${md - 2}`];
124+
if (minus2 === loc) {
125+
return true;
126+
}
127+
} else if (plus1 === loc) {
128+
const plus2 = c.locationByMatchday[`${t}:${md + 2}`];
129+
if (plus2 === loc) {
130+
return true;
131+
}
132+
}
133+
}
134+
}
135135

136136
return false;
137137
},

0 commit comments

Comments
 (0)