Skip to content

Commit

Permalink
fix: default last_activity to None
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrckd committed Sep 12, 2024
1 parent 472465c commit 853c8ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
from bot_msg import AlbertMsg

UserRecord = namedtuple(
"UserRecord", ["id", "tchap_user", "status", "domain", "n_questions", "last_activity"]
"UserRecord",
["id", "tchap_user", "status", "domain", "n_questions", "last_activity"],
defaults=(None,), # default apply following the rightmost parameter first.
)

def to_record(_id: str, data: dict):
"""Dict to a grist record"""
return UserRecord(
**{"id": _id, **{k: v for k, v in data.items() if k in UserRecord._fields}}
)

def to_record(_id: str, data: dict) -> UserRecord:
"""Dict to a grist record"""
return UserRecord(**{"id": _id, **{k: v for k, v in data.items() if k in UserRecord._fields}})


# from grist_api import GristDocAPI => is not async
Expand Down

0 comments on commit 853c8ab

Please sign in to comment.