Skip to content

Commit

Permalink
Merge pull request #37 from Nexters/fix/remove-contact-faq
Browse files Browse the repository at this point in the history
fix(contact): applying removed informations (#36)
  • Loading branch information
delphox60 authored Oct 30, 2023
2 parents b4ba804 + dcdbba6 commit b7f037a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions content_generator/_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
from os import remove, listdir
import re
from typing import List

GoogleSheetResult = List[List[str]]
Expand Down Expand Up @@ -293,10 +295,20 @@ def make_contacts(contact_us: GoogleSheetResult, faq: GoogleSheetResult) -> None
"answer": answer
}
_faqs.append(_faq)

content_file_pattern = re.compile("[0-9]+\.json")

for filename in listdir("./content/contacts"):
if content_file_pattern.match(filename):
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 content_file_pattern.match(filename):
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 b7f037a

Please sign in to comment.