Skip to content

Commit

Permalink
story part auto bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sctop committed Mar 31, 2024
1 parent aafe828 commit 797c472
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion data
Submodule data updated from d224c7 to 627bb9
29 changes: 23 additions & 6 deletions data_model/actual_data/_story/story_part_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def load(self):
temp.register(self.story)
self.background[i] = temp
except KeyError:
logging.warning("No track info about: " + repr(i))
logging.warning("No bg info about: " + repr(i))
# track
for i in self.data["track"]:
temp = TrackInfo.get_instance(i)
Expand Down Expand Up @@ -61,6 +61,9 @@ def __init__(self, data, story):
self._char_to_track = KeyToMultiValueDict()
self._bg_to_char = KeyToMultiValueDict()

self._track_to_bg = KeyToMultiValueDict()
self._char_to_bg = KeyToMultiValueDict()

self.data_special = {
"flag": self.data["special"]["flag"],
"track": None if self.data["special"]["track"] == "OST_0" else TrackInfo.get_instance(
Expand Down Expand Up @@ -95,6 +98,7 @@ def load(self):
bg.register(track)

self._bg_to_track[bg_id] = track_id
self._track_to_bg[track_id] = bg.uuid

# track to char
for (track_id, chars) in self.data["track_to_char"].items():
Expand All @@ -108,10 +112,10 @@ def load(self):
except KeyError:
continue

track.register(char)
char.register(track)
track.register(char)
char.register(track)

self._char_to_track[char_id] = track_id
self._char_to_track[char_id] = track_id

# char to bg
for (char_id, bgs) in self.data["char_to_bg"].items():
Expand All @@ -133,6 +137,7 @@ def load(self):
bg.register(char)

self._bg_to_char[bg_id] = char_id
self._char_to_bg[char_id] = bg.uuid

# char to char
for (char_id, data) in self.data["char_to_char"].items():
Expand All @@ -153,12 +158,24 @@ def load(self):
def to_json(self):
return {
"all": self.data_all.to_json(),
"track_to_bg": self.data["track_to_bg"],

# for normal
"_track_to_bg": self.data["track_to_bg"],
# for indexing
"track_to_bg": self._track_to_bg.to_json(),

"track_to_char": self.data["track_to_char"],

"bg_to_char": self._bg_to_char.to_json(),
"bg_to_track": self._bg_to_track.to_json(),

"char_to_track": self._char_to_track.to_json(),
"char_to_bg": self.data["char_to_bg"],

# for normal
"_char_to_bg": self.data["char_to_bg"],
# for indexing
"char_to_bg": self._char_to_bg.to_json(),

"char_to_char": self.data["char_to_char"],
"special": {
"flag": self.data_special["flag"],
Expand Down

0 comments on commit 797c472

Please sign in to comment.