Skip to content

Commit 68fd2da

Browse files
committed
fix: apg sub story error
1 parent 9c408fa commit 68fd2da

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

autopcr/module/modules/story.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ async def do_task(self, client: pcrclient):
199199

200200
if any(sub_story.status == eEventSubStoryStatus.ADDED for sub_story in sub_storys.sub_story_info_list):
201201
await reader.confirm()
202-
for sub_story in sub_storys.sub_story_info_list:
202+
for sub_story in await reader.sort_by_time(sub_storys.sub_story_info_list):
203203
if sub_story.status == eEventSubStoryStatus.UNREAD and reader.is_readable(sub_story.sub_story_id):
204204
await reader.read(sub_story.sub_story_id)
205205
self._log(f"阅读了{reader.title(sub_story.sub_story_id)}")

autopcr/util/substory.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ async def special_read(self, sub_storys: List[EventSubStory], _log: Callable): .
3636
async def confirm(self): ...
3737
async def prepare(self):
3838
pass
39+
async def sort_by_time(self, sub_story_ids: List[EventSubStory]) -> List[EventSubStory]:
40+
return sub_story_ids
3941

4042
def __init__(self, client: pcrclient):
4143
self.client = client
@@ -108,6 +110,9 @@ async def prepare(self):
108110
async def read(self, sub_story_id: int):
109111
await self.client.read_apg_story(sub_story_id)
110112

113+
async def sort_by_time(self, sub_story_ids: List[EventSubStory]) -> List[EventSubStory]:
114+
return sorted(sub_story_ids, key=lambda s: db.parse_time(db.apg_story_data[s.sub_story_id].condition_time))
115+
111116
@EventId(10140)
112117
class fpc_substory(SubStoryReader):
113118
special = True

0 commit comments

Comments
 (0)