From ad488cc848e35c0780ed06bdcc0e3d8acbd18e5d Mon Sep 17 00:00:00 2001 From: Dennis Jen Date: Wed, 23 Jan 2019 15:40:28 -0500 Subject: [PATCH] Fix news task --- client/app/constants/index.js | 2 +- server/scripts/queue_latest_news_posts.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/app/constants/index.js b/client/app/constants/index.js index 690f3629..71e32380 100644 --- a/client/app/constants/index.js +++ b/client/app/constants/index.js @@ -18,6 +18,6 @@ export const DELETE_USER_REQUEST = 'DELETE_USER_REQUEST'; export const DELETE_USER_SUCCESS = 'DELETE_USER_SUCCESS'; export const DELETE_USER_FAILURE = 'DELETE_USER_FAILURE'; -export const VERSION = 'v1.9.0'; +export const VERSION = 'v1.9.1'; export const API_URL = ''; // process.env.NODE_ENV === 'production' ? '': 'http://localhost:5000/' diff --git a/server/scripts/queue_latest_news_posts.py b/server/scripts/queue_latest_news_posts.py index 6bb57e9d..c2a64ed3 100644 --- a/server/scripts/queue_latest_news_posts.py +++ b/server/scripts/queue_latest_news_posts.py @@ -31,13 +31,13 @@ def queue_one_news_post(post, source, quintile, db_session): added_new = False try: post_id = post['id_str'] if 'id_str' in post else str(post['id']) - post_item = Post.query.filter_by(original_id=post_id, source=source).first() - if not post_item: + post_item = db_session.query(Post).filter_by(original_id=post_id, source=source).first() + if post_item: + post_item.update_content(post, is_news=True) + else: post_item = Post(post_id, source, post, True) db_session.add(post_item) added_new = True - else: - post_item.update_content(post, is_news=True) post_item.political_quintile = quintile