Skip to content

Commit

Permalink
Merge pull request #231 from sarah256/recent-stories
Browse files Browse the repository at this point in the history
Update date is null for older advisories, so accomodated for that in recents query
  • Loading branch information
mprahl committed Mar 18, 2019
2 parents fdac2c7 + cd84011 commit 93f571c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion estuary/utils/recents.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def get_recent_nodes():
final_result = {}
for label, time_property in label_dict.items():
query = (
'MATCH (node:{label}) RETURN node '
'MATCH (node:{label}) '
'WHERE node.{time_property} IS NOT NULL '
'RETURN node '
'ORDER BY node.{time_property} DESC LIMIT 5'
).format(label=label, time_property=time_property)
results, _ = db.cypher_query(query)
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/test_recents.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def test_get_recent_nodes():
'id_': '66666',
'update_date': datetime(2017, 5, 30, 11, 44, 38)
})
Advisory.get_or_create({
'id_': '66666',
'update_date': None
})
FreshmakerEvent.get_or_create({
'id_': '77777'
})
Expand Down

0 comments on commit 93f571c

Please sign in to comment.