Skip to content

Add last_active_at column to users page#191

Merged
alison985 merged 2 commits intomozilla:masterfrom
alison985:155_users_page_last_active_column
Aug 17, 2017
Merged

Add last_active_at column to users page#191
alison985 merged 2 commits intomozilla:masterfrom
alison985:155_users_page_last_active_column

Conversation

@alison985
Copy link
Copy Markdown

@alison985 alison985 requested a review from washort August 12, 2017 01:22
@alison985 alison985 added this to the 9 milestone Aug 12, 2017
@alison985
Copy link
Copy Markdown
Author

@washort This works in the UI, but the following test passes and I'm not sure how to fix it:

======================================================================
FAIL: test_get_query (tests.handlers.test_queries.TestQueryResourceGet)

Traceback (most recent call last):
File "/app/tests/handlers/test_queries.py", line 17, in test_get_query
self.assertResponseEqual(expected, rv.json)
File "/app/tests/init.py", line 115, in assertResponseEqual
self.assertResponseEqual(v, actual[k])
File "/app/tests/init.py", line 118, in assertResponseEqual
self.assertEqual(v, actual[k], "{} not equal (expected: {}, actual: {}).".format(k, v, actual[k]))
AssertionError: last_active_at not equal (expected: SELECT events.created_at AS events_created_at
FROM events
WHERE events.user_id = %(user_id_1)s ORDER BY events.created_at DESC
LIMIT %(param_1)s, actual: []).

@washort
Copy link
Copy Markdown

washort commented Aug 14, 2017

The error is because last_active_at is being set to a query object and the response handler is converting it to a list. Since you expect at most one result, I'd call .first() on that query and adjust the template to only expect a single value.

@alison985
Copy link
Copy Markdown
Author

@washort Thanks. Updated.

@washort
Copy link
Copy Markdown

washort commented Aug 16, 2017

r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants