Browse Source

課題 #5 に対する対応

feature/query
みてるぞ 1 month ago
parent
commit
283b628053
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      update_db.py

+ 8
- 1
update_db.py View File

@@ -9,6 +9,7 @@ import os
import random import random
import string import string
import time import time
import unicodedata
from dataclasses import dataclass from dataclasses import dataclass
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from typing import Any, Type, TypedDict, cast from typing import Any, Type, TypedDict, cast
@@ -158,7 +159,7 @@ def update_tables (
for vt in video_tags: for vt in video_tags:
tag = tag_dao.find (vt.tag_id) tag = tag_dao.find (vt.tag_id)
if (tag is not None if (tag is not None
and (tag.name.upper () not in map (str.upper, tag_names))
and (normalise (tag.name) not in map (normalise, tag_names))
and (tag.id_ is not None)): and (tag.id_ is not None)):
tag_ids.append (tag.id_) tag_ids.append (tag.id_)
video_tag_dao.untag_all (video.id_, tag_ids, now) video_tag_dao.untag_all (video.id_, tag_ids, now)
@@ -1067,5 +1068,11 @@ class UserDto:
id_: int | None = None id_: int | None = None




def normalise (
s: str
) -> str:
return unicodedata.normalize ('NFKC', s).lower ()


if __name__ == '__main__': if __name__ == '__main__':
main () main ()

Loading…
Cancel
Save