Commit dd9740c4 by dong

fix20230427

parent f59689e0
...@@ -294,7 +294,7 @@ def prolink(): ...@@ -294,7 +294,7 @@ def prolink():
edata = edata.all() edata = edata.all()
if edata: if edata:
num = [math.ceil(i.score) if i.score else 0 for i in edata] num = list(set(math.ceil(i.score) if i.score else 0 for i in edata))
num.sort() num.sort()
num = [i for i in num if i > 0] num = [i for i in num if i > 0]
if not num: if not num:
...@@ -325,12 +325,21 @@ def prolink(): ...@@ -325,12 +325,21 @@ def prolink():
# 按照企业数量排序 # 按照企业数量排序
for name in result_bylink: for name in result_bylink:
company_count = Enterprise.query.filter(Enterprise.city != '晋城市').filter(or_( # company_count = Enterprise.query.filter(Enterprise.city != '晋城市').filter(or_(
Enterprise.product_all.like("%{}%".format(name)), # Enterprise.product_all.like("%{}%".format(name)),
Enterprise.product_all1.like("%{}%".format(name)), # Enterprise.product_all1.like("%{}%".format(name)),
Enterprise.product_all2.like("%{}%".format(name)) # Enterprise.product_all2.like("%{}%".format(name))
)).count() # )).count()
df2.append({'name': name, 'company_count': company_count}) try:
company_count = IndustryChain.query.filter_by(industry_name=name, chain_id=inid).first().enterprise_num
if company_count:
pass
else:
company_count = 0
df2.append({'name': name, 'company_count': company_count})
except:
company_count = 0
df2.append({'name': name, 'company_count': company_count})
df2.sort(key=lambda s: s['company_count'], reverse=True) df2.sort(key=lambda s: s['company_count'], reverse=True)
df2 = df2[(page - 1) * perpage:page * perpage] df2 = df2[(page - 1) * perpage:page * perpage]
data = {"df": df2, "size": res} data = {"df": df2, "size": res}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment