Skip to content

Commit

Permalink
fix(contact): applying removed informations (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
delphox60 committed Oct 29, 2023
1 parent b4ba804 commit 0a334fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions content_generator/_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from os import remove, listdir
from typing import List

GoogleSheetResult = List[List[str]]
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0a334fc

Please sign in to comment.