Skip to content

Commit

Permalink
Merge pull request #1978 from getredash/patches
Browse files Browse the repository at this point in the history
Fix #1950: record_event fails for api events
  • Loading branch information
arikfr authored Sep 27, 2017
2 parents 50eb9a8 + 18d9b2e commit 505f338
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions redash/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ def update_model(self, model, updates):


def record_event(org, user, options):
if isinstance(user, ApiUser):
if user.is_api_user():
options.update({
'api_key': user.name,
'org_id': org.id
})
else:
options.update({
'user_id': user.id,
'user_name': user.name,
'org_id': org.id
})

Expand Down Expand Up @@ -88,7 +89,7 @@ def paginate(query_set, page, page_size, serializer):
if page < 1:
abort(400, message='Page must be positive integer.')

if (page-1)*page_size+1 > count > 0:
if (page - 1) * page_size + 1 > count > 0:
abort(400, message='Page is out of range.')

if page_size > 250 or page_size < 1:
Expand Down

0 comments on commit 505f338

Please sign in to comment.