modify log_action to internally resolve IDs
This commit is contained in:
parent
052c31752b
commit
ce14b9dddf
1 changed files with 7 additions and 1 deletions
|
@ -22,7 +22,7 @@ def _logs_query(selections, start_time, end_time, performer=None, repository=Non
|
||||||
joined = joined.where(LogEntry.performer == performer)
|
joined = joined.where(LogEntry.performer == performer)
|
||||||
|
|
||||||
if namespace:
|
if namespace:
|
||||||
joined = joined.join(User).where(User.username == namespace)
|
joined = joined.join(User, on=(User.username == namespace))
|
||||||
|
|
||||||
if ignore:
|
if ignore:
|
||||||
kind_map = get_log_entry_kinds()
|
kind_map = get_log_entry_kinds()
|
||||||
|
@ -88,6 +88,12 @@ def log_action(kind_name, user_or_organization_name, performer=None, repository=
|
||||||
if account is None:
|
if account is None:
|
||||||
account = User.select(fn.Min(User.id)).tuples().get()[0]
|
account = User.select(fn.Min(User.id)).tuples().get()[0]
|
||||||
|
|
||||||
|
if performer is not None:
|
||||||
|
performer = performer.id
|
||||||
|
|
||||||
|
if repository is not None:
|
||||||
|
repository = repository.id
|
||||||
|
|
||||||
kind = _get_log_entry_kind(kind_name)
|
kind = _get_log_entry_kind(kind_name)
|
||||||
metadata_json = json.dumps(metadata, default=_json_serialize)
|
metadata_json = json.dumps(metadata, default=_json_serialize)
|
||||||
LogEntry.create(kind=kind, account=account, performer=performer,
|
LogEntry.create(kind=kind, account=account, performer=performer,
|
||||||
|
|
Reference in a new issue