Skip to content

Commit 23d0a2e

Browse files
committed
Fix submission of the solution due to using old challenge interface
1 parent 70cbc83 commit 23d0a2e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

66
## Unreleased
7+
### Fixed
8+
- Fix submission of the solution due to using old challenge interface
9+
710
## 0.2.0 - 30.11.2024
811
### Added
912
- Extend cli with possibility to specify directories for: templates, challenges solutions, and data

src/aoc/main.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from aocd.exceptions import PuzzleLockedError
1313
from aocd.models import Puzzle
1414

15+
from aoc.base import BaseChallenge
1516
from aoc.input_providers import SingleFileInputProvider, SmartFileInputProvider
1617

1718
app = typer.Typer(no_args_is_help=True)
@@ -229,13 +230,25 @@ def submit(
229230
help="Which part of the solution to submit. "
230231
"You can use numbers 1/2 or letters a/b."
231232
),
233+
data_directory: Annotated[
234+
Path,
235+
typer.Option(
236+
help="Path to a directory with data. Will be used if you won't provide"
237+
" --file/-f option"
238+
),
239+
] = Path("data"),
232240
):
233241
validated_part = _full_validate(part)
234242
module = import_challenge_module(year, day)
243+
challenge: BaseChallenge = module.Challenge(
244+
SmartFileInputProvider(
245+
year=year, day=day, data_dir=data_directory, use_test_data=False
246+
)
247+
)
235248
if validated_part == "a":
236-
solution = module.Challenge(use_test_data=False).part_1()
249+
solution = challenge.part_1(challenge.get_input_lines(part=1))
237250
else:
238-
solution = module.Challenge(use_test_data=False).part_2()
251+
solution = challenge.part_2(challenge.get_input_lines(part=2))
239252
aocd.submit(solution, day=day, year=year, part=validated_part)
240253

241254

0 commit comments

Comments
 (0)