From 0a334fc1a74f346b100e764c3ee320b62ddae18a Mon Sep 17 00:00:00 2001 From: Gibeom Lim Date: Sun, 29 Oct 2023 15:35:16 +0900 Subject: [PATCH] fix(contact): applying removed informations (#36) --- content_generator/_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content_generator/_utils.py b/content_generator/_utils.py index 1447a5a..068c233 100644 --- a/content_generator/_utils.py +++ b/content_generator/_utils.py @@ -1,4 +1,5 @@ import json +from os import remove, listdir from typing import List GoogleSheetResult = List[List[str]] @@ -293,10 +294,18 @@ def make_contacts(contact_us: GoogleSheetResult, faq: GoogleSheetResult) -> None "answer": answer } _faqs.append(_faq) + + for filename in listdir("./content/contacts"): + if filename.endswith(".json"): + remove(f"./content/contacts/{filename}") for idx, _contact in enumerate(_contacts): with open(f"./content/contacts/{idx}.json", mode="w", encoding="utf-8") as f: f.write(json.dumps(_contact, ensure_ascii=False, indent=2)) + + for filename in listdir("./content/contacts/faq"): + if filename.endswith(".json"): + remove(f"./content/contacts/faq/{filename}") for idx, _faq in enumerate(_faqs): with open(f"./content/contacts/faq/{idx}.json", mode="w", encoding="utf-8") as f: