Also export keycard creation date from ookean
This commit is contained in:
parent
cf7342035d
commit
de8af3cb0d
@ -7,7 +7,7 @@ db = _mysql.connect(host="localhost", db="ookean",
|
||||
user="root", passwd="salakala")
|
||||
|
||||
db.query("""
|
||||
select persons.name, t2.uid, t2.name from persons join tagowners t on persons.id = t.person_id join tags t2 on t.tag_id = t2.id
|
||||
select persons.name, t2.uid, t2.name, t2.create_date from persons join tagowners t on persons.id = t.person_id join tags t2 on t.tag_id = t2.id
|
||||
where persons.archived is null and t.revoked_date is null and t2.archived is null;
|
||||
""")
|
||||
r=db.store_result()
|
||||
@ -26,16 +26,16 @@ nicknames = {
|
||||
cards = defaultdict(list)
|
||||
|
||||
for x in range(r.num_rows()):
|
||||
name, uid, descr = r.fetch_row()[0]
|
||||
name, uid, descr = name.decode(), uid.decode(), descr.decode() if descr else descr
|
||||
name, uid, descr, create_date = r.fetch_row()[0]
|
||||
name, uid, descr, create_date = name.decode(), uid.decode(), descr.decode() if descr else descr, create_date.decode()
|
||||
name = name.replace("(deactivated)", "")\
|
||||
.replace("(Deactivated)","").replace("(Paused)", "").replace("(disactive)", "")\
|
||||
.replace("(Disabled)", "").replace("(Protoskoop)", "")\
|
||||
.strip()
|
||||
if name in nicknames:
|
||||
name = nicknames[name]
|
||||
cards[name].append({"uid": uid, "descr": descr})
|
||||
print(f"{name:30} {uid:20} {descr}")
|
||||
cards[name].append({"uid": uid, "descr": descr, "create_date":str(create_date)})
|
||||
print(f"{name:30} {uid:20} {str(create_date)} {descr}")
|
||||
|
||||
with open("ookean_cards.json", "w") as fp:
|
||||
json.dump(cards, fp, indent=2)
|
||||
|
Loading…
Reference in New Issue
Block a user