Commit 83c7ea13 authored by DmitSPopov's avatar DmitSPopov
Browse files

Clean bags

parent 56a6e149
......@@ -99,6 +99,7 @@ def calc_recomendation_by_location(user_data, all_data, tags_recomendation):
def get_recomendation_by_tags(user_id: int, all_adv=all_advertisments()):
queryset = db.session.query(ClickHistory).filter(ClickHistory.user_id==user_id).all()
print(queryset)
all_tags = []
for _ in queryset:
all_tags.append(_.tags_id)
......@@ -115,7 +116,10 @@ def get_recomendation_by_tags(user_id: int, all_adv=all_advertisments()):
tag_id.append(val['connect_tags']['id'])
all_data[_['id']] = tag_id
# print("user data by tags", user_data)
# print("all data by tags: ", all_data)
result_id = calc_recomendation_by_tags(user_data, all_data)
# print("result_by_tags:", result_id)
return result_id
......@@ -130,4 +134,8 @@ def get_recomendation_by_location(user_id: int, location_str: str):
coords[0], coords[1] = float(coords[0]), float(coords[1])
distance_data[_['id']] = coords
# print(distance_user)
# print(distance_data)
return calc_recomendation_by_location(distance_user, distance_data, get_recomendation_by_tags(user_id, all_adv))
# print(get_recomendation_by_location(2, "55.53570015221644, 36.95149256704093"))
\ No newline at end of file
Supports Markdown
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