remove previous stuff from asquare and put it in glue
This commit is contained in:
1 parent
d612003f32
commit
04cfd42b4b
1 file changed
-23
@@ -120,28 +120,6 @@ async def acat2id(cat_id: str):
|
|||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
async def do_review() -> bool:
|
|
||||||
result = await acat2id(LEGO_CAT_ID)
|
|
||||||
for item in result:
|
|
||||||
if not re.match(r".*\d{5}.*", item["name"]):
|
|
||||||
missing = []
|
|
||||||
print(f"{item} is missing its set number!")
|
|
||||||
print(f"[@DEBUG] Upserting {item['id']} into REVIEW table")
|
|
||||||
item_sanitized = {
|
|
||||||
"sq_object": item["id"],
|
|
||||||
"set_name": item["name"],
|
|
||||||
"set_number": None,
|
|
||||||
"time_added": time
|
|
||||||
}
|
|
||||||
missing.append(item_sanitized)
|
|
||||||
for item in missing:
|
|
||||||
sq_item = await db.fetch(item["id"]) #
|
|
||||||
if item["id"] != sq_item["sq_object"]:
|
|
||||||
await db.upsert("REVIEW", item_sanitized, "sq_object")
|
|
||||||
print(f"[@DEBUG] Upserted {item['id']} into REVIEW table")
|
|
||||||
print(f"[@DEBUG] {item['id']} already in REVIEW table")
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def test() -> None:
|
async def test() -> None:
|
||||||
task = asyncio.create_task(acat2id(LEGO_CAT_ID)) # type: ignore
|
task = asyncio.create_task(acat2id(LEGO_CAT_ID)) # type: ignore
|
||||||
@@ -162,7 +140,6 @@ async def test() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Spooling up..")
|
|
||||||
print(f"@[DEBUG] ENV:\t{ENVIRONMENT}")
|
print(f"@[DEBUG] ENV:\t{ENVIRONMENT}")
|
||||||
print(f"@[DEBUG] CATID:\t{LEGO_CAT_ID}")
|
print(f"@[DEBUG] CATID:\t{LEGO_CAT_ID}")
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
Reference in new issue
Block a user