Skip to content

Commit

Permalink
fix(words): remove duplicated characters on CH0204 (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
CapooL authored Nov 23, 2023
1 parent c0e71a6 commit 80bd4ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
6 changes: 6 additions & 0 deletions hinghwa-dict-backend/word/character/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ def searchCharactersPinyin(request):
result1[pinyin]["characters"].append(
{"character": character, "word": word, "traditional": traditional}
)
unique_result = []
exist_set = set()
for item in result1.values():
if item["pinyin"] not in exist_set:
unique_result.append(item)
exist_set.add(item["pinyin"])
return JsonResponse({"result": list(result1.values())}, status=200)
else:
return JsonResponse({}, status=405)
Expand Down
16 changes: 0 additions & 16 deletions hinghwa-dict-backend/word/migrations/0005_listadmin.py

This file was deleted.

0 comments on commit 80bd4ff

Please sign in to comment.