Skip to content

Commit

Permalink
Bug fixes 2024/01/14
Browse files Browse the repository at this point in the history
- _loader.py sort_by_int
- story.py now exports namespace
- character.used_by bug fix
- CharacterLoader auto_include added
  • Loading branch information
sctop committed Jan 13, 2024
1 parent b5a660b commit 31333d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data_model/actual_data/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def to_json(self, no_used_by: bool = True):
self.data_background_direct.get_counter_with_data_sorted_by_counter(),
["filename"])
d["data_background_by_comm"] = counter_dict_sorter(
self.data_background_direct.get_counter_with_data_sorted_by_counter(),
self.data_background_by_comm.get_counter_with_data_sorted_by_counter(),
["filename"])
d["data_character"] = counter_dict_sorter(self.data_character.get_counter_with_data_sorted_by_counter(),
[["name", "path_name"], ["name", "en"]])
Expand Down
2 changes: 2 additions & 0 deletions data_model/actual_data/story.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def to_json(self):
t = {
"uuid": self.uuid,
"filetype": self.filetype,
"namespace": self.namespace,

"name": self.name.to_json_basic(),
"desc": [i for i in self.desc.to_json_basic()],
Expand Down Expand Up @@ -317,6 +318,7 @@ def to_json(self):
t = {
"uuid": self.uuid,
"filetype": self.filetype,
"namespace": self.namespace,

"name": self.name.to_json_basic(),
"desc": [i for i in self.desc.to_json_basic()],
Expand Down
5 changes: 4 additions & 1 deletion data_model/loader/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def auto_include(self):

@staticmethod
def sort_by_int(item):
return int(item[:-5])
try:
return str(int(item[:-5])).rjust(3, "0")
except ValueError:
return item

def process(self):
from .loader_detect import get_loader_by_filepath
Expand Down
5 changes: 5 additions & 0 deletions data_model/loader/folder_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ def to_json_basic(self):
pass
return d

def auto_include(self):
temp = super().auto_include()
temp.sort(key=self.sort_by_int)
return temp


class AlbumLoader(GenericFolder):
def __init__(self, namespace: list, basepath, json_data=None, parent_data=None):
Expand Down

0 comments on commit 31333d3

Please sign in to comment.