From ea6ae494cd5a9a537dc4c73de24e35c35d5e68fe Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Wed, 22 Mar 2023 10:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E4=BB=B7=E6=A0=BC=E6=8E=92?= =?UTF-8?q?=E5=90=8D=E6=89=93=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/community/relative_price_ranking.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dags/business/business/community/relative_price_ranking.py b/dags/business/business/community/relative_price_ranking.py index bb8323c..9f03336 100644 --- a/dags/business/business/community/relative_price_ranking.py +++ b/dags/business/business/community/relative_price_ranking.py @@ -62,6 +62,8 @@ def build_doc(item): doc_dict = dict() if 'relative_price_ranking' in item and pd.notna(item['relative_price_ranking']): doc_dict['relative_price_ranking'] = item['relative_price_ranking'] + if 'credit_detail' in item: + doc_dict['credit_detail'] = item['credit_detail'] return doc_dict @@ -87,6 +89,18 @@ def find_around_price_item(seaweed): 'relative_price_ranking'] elif len(around_seaweed_df) == 1: seaweed['relative_price_ranking'] = 0.5 + + around_community_num = len(around_seaweed_df) + if around_community_num >= 20: + relative_price_ranking_score = 10 + elif 5 <= around_community_num < 20: + relative_price_ranking_score = 9 + elif 1 < around_community_num < 5: + relative_price_ranking_score = 8 + elif around_community_num == 1: + relative_price_ranking_score = 7 + + seaweed['credit_detail'] = {'around_community_num': around_community_num, 'relative_price_ranking_score': relative_price_ranking_score} mutex.release()