Skip to content

Commit

Permalink
fix(single-mode): handle multi course race
Browse files Browse the repository at this point in the history
close #351
  • Loading branch information
NateScarlet committed Aug 21, 2022
1 parent d5de069 commit 22c56fc
Show file tree
Hide file tree
Showing 52 changed files with 955 additions and 3,434 deletions.
1,163 changes: 388 additions & 775 deletions auto_derby/data/single_mode_races.jsonl

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions auto_derby/single_mode/item/plan_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from auto_derby.constants import TrainingType
from auto_derby.single_mode.commands.training import TrainingCommand
from auto_derby.single_mode.race.race import Race, RaceFilters
from auto_derby.single_mode.training.training import Training
from . import plan, test_sample, item_list, game_data
from . import plan, test_sample
from .globals import g

from ..commands import RaceCommand
Expand All @@ -21,7 +22,13 @@ def test_duplicated_effect():
race.reload_on_demand()
s, items = plan.compute(
ctx,
RaceCommand(next(i for i in race.g.races if i.name == "トゥインクルスタークライマックス 第3戦")),
RaceCommand(
next(
Race.repository.find(
filter_by=RaceFilters(name=("トゥインクルスタークライマックス 第3戦",))
)
)
),
)
assert s > 0
assert len(items) == 1
Expand Down
4 changes: 2 additions & 2 deletions auto_derby/single_mode/item/test_sample.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from auto_derby.single_mode.race.race import Race
from ...constants import Mood, TrainingType
from .. import race

Expand Down Expand Up @@ -134,7 +135,6 @@ def trainings():


def races():
race.game_data.reload_on_demand()
names = {
"ジュニア級未勝利戦",
"朝日杯フューチュリティステークス",
Expand All @@ -144,7 +144,7 @@ def races():
"有馬記念",
"ジャパンダートダービー",
}
for i in race.game_data.g.races:
for i in Race.repository.find():
if i.name in names:
yield i
names.remove(i.name)
4 changes: 2 additions & 2 deletions auto_derby/single_mode/race/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
find_by_date,
find_by_race_detail_image,
find_by_race_menu_image,
reload,
reload_on_demand,
reload, # type: ignore
reload_on_demand, # type: ignore
)
from .globals import g
from .race import Race
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Race<G2 弥生賞#0001-0074>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Race<G3 小倉ジュニアステークス#0001-0026>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Race<OP 忘れな草賞#0001-0084>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Race<G1 NHKマイルカップ#0001-008d>
Loading

0 comments on commit 22c56fc

Please sign in to comment.