Skip to content

Commit

Permalink
fix create bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata committed Dec 2, 2024
1 parent a023a36 commit 9c99d4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/utils/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ export async function downloadIndex(year, bar, stars) {

export async function createSolver(year, day) {
const page = await getYearPage(year);
if (page.match(new RegExp(`key = "${year}-(\\d+)-"`))) {
const [, actual] = page.match(new RegExp(`key = "${year}-(\\d+)-"`));
day = actual;
}
if (page.match(/server_eta = (\d+)/)) {
const actual = page.match(new RegExp(`key = "${year}-(\\d+)-"`))?.[1];
if (actual === day && page.match(/server_eta = (\d+)/)) {
const [, eta] = page.match(/server_eta = (\d+)/);
const create = await timeoutConfirm({
message: `Create solver ${year}/${dayName(day)}?`,
Expand Down
4 changes: 2 additions & 2 deletions templates/day.template.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const input = readInput(import.meta.url);
describe.only("{{day}} {{year}}", () => {
describe("part1", () => {
test("it should work for part 1 examples", () => {
expect(part1("1")).toEqual(0);
expect(part1(paste)).toEqual(0);
});

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

describe("part2", () => {
test("it should work for part 2 examples", () => {
// expect(part2('1')).toEqual(0);
// expect(part2(paste)).toEqual(0);
});

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

0 comments on commit 9c99d4b

Please sign in to comment.