Skip to content

Commit 9c99d4b

Browse files
committed
fix create bug
1 parent a023a36 commit 9c99d4b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/utils/renderer.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ export async function downloadIndex(year, bar, stars) {
8383

8484
export async function createSolver(year, day) {
8585
const page = await getYearPage(year);
86-
if (page.match(new RegExp(`key = "${year}-(\\d+)-"`))) {
87-
const [, actual] = page.match(new RegExp(`key = "${year}-(\\d+)-"`));
88-
day = actual;
89-
}
90-
if (page.match(/server_eta = (\d+)/)) {
86+
const actual = page.match(new RegExp(`key = "${year}-(\\d+)-"`))?.[1];
87+
if (actual === day && page.match(/server_eta = (\d+)/)) {
9188
const [, eta] = page.match(/server_eta = (\d+)/);
9289
const create = await timeoutConfirm({
9390
message: `Create solver ${year}/${dayName(day)}?`,

templates/day.template.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const input = readInput(import.meta.url);
66
describe.only("{{day}} {{year}}", () => {
77
describe("part1", () => {
88
test("it should work for part 1 examples", () => {
9-
expect(part1("1")).toEqual(0);
9+
expect(part1(paste)).toEqual(0);
1010
});
1111

1212
test("it should work for part 1 input", () => {
@@ -16,7 +16,7 @@ describe.only("{{day}} {{year}}", () => {
1616

1717
describe("part2", () => {
1818
test("it should work for part 2 examples", () => {
19-
// expect(part2('1')).toEqual(0);
19+
// expect(part2(paste)).toEqual(0);
2020
});
2121

2222
test("it should work for part 2 input", () => {

0 commit comments

Comments
 (0)