modify log_action to internally resolve IDs

This commit is contained in:
Jimmy Zelinskie 2016-08-05 16:37:04 -04:00
parent 052c31752b
commit ce14b9dddf

View file

@ -22,7 +22,7 @@ def _logs_query(selections, start_time, end_time, performer=None, repository=Non
joined = joined.where(LogEntry.performer == performer)
if namespace:
joined = joined.join(User).where(User.username == namespace)
joined = joined.join(User, on=(User.username == namespace))
if ignore:
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:
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)
metadata_json = json.dumps(metadata, default=_json_serialize)
LogEntry.create(kind=kind, account=account, performer=performer,