Skip to content

Commit

Permalink
try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Dec 17, 2023
1 parent 28cba84 commit f76429c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 0 additions & 3 deletions chii/timeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ class SubjectMemo(BaseModel):
collect_comment: str
collect_rate: int
subject_id: str
subject_name: str
subject_name_cn: str
subject_series: bool = False
subject_type_id: str


class SubjectImage(BaseModel):
Expand Down
14 changes: 5 additions & 9 deletions rpc/timeline_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def SubjectCollect(

return SubjectCollectResponse(ok=True)

@staticmethod
def merge_previous_timeline(
self, session: Session, tl: ChiiTimeline, req: SubjectCollectRequest
session: Session, tl: ChiiTimeline, req: SubjectCollectRequest
):
escaped = html.escape(req.comment)
if tl.batch:
Expand All @@ -95,18 +96,15 @@ def merge_previous_timeline(
m.collect_rate = req.rate

if should_update:
tl.memo = php.serialize(m.dict())
tl.memo = php.serialize(m.model_dump())

Check warning on line 99 in rpc/timeline_service.py

View check run for this annotation

Codecov / codecov/patch

rpc/timeline_service.py#L99

Added line #L99 was not covered by tests
session.add(tl)
return

memo = {int(m.subject_id): m}

memo[req.subject.id] = SubjectMemo(
subject_id=str(req.subject.id),
subject_type_id=str(req.subject.type),
subject_name_cn=req.subject.name_cn,
subject_series=req.subject.series,
subject_name=req.subject.name,
collect_comment=escaped,
collect_rate=req.rate,
)
Expand All @@ -129,15 +127,13 @@ def merge_previous_timeline(

session.add(tl)

@staticmethod
def create_subject_collection_timeline(
self, session: Session, req: SubjectCollectRequest, type: int
session: Session, req: SubjectCollectRequest, type: int
):
memo = SubjectMemo(
subject_id=str(req.subject.id),
subject_type_id=str(req.subject.type),
subject_name_cn=req.subject.name_cn,
subject_series=req.subject.series,
subject_name=req.subject.name,
collect_comment=html.escape(req.comment),
collect_rate=req.rate,
)
Expand Down

0 comments on commit f76429c

Please sign in to comment.