@@ -52,12 +52,13 @@ def get_customer_history(self, customer_id):
5252
5353 return items_docs
5454
55- def add_search_result (self , item_id , item_score , customer_id ):
55+ def add_search_result (self , item_id , item_score , customer_id , item_name ):
5656 print (f"\n Adding search result for Item ID(s): { item_id } , score(s): { item_score } " )
5757 self .db .collection ("customer" ).document (customer_id ).collection ("history" ).add ({
5858 "timestamp" : datetime .now ().strftime ("%Y-%m-%d %H:%M:%S" ),
5959 "items" : item_id ,
60- "score" : item_score
60+ "score" : item_score ,
61+ "item_name" :item_name
6162 })
6263
6364 def add_purchase (self , item_id , customer_id ):
@@ -89,7 +90,7 @@ def check_csv(self, item_name, country_code):
8990
9091 return False ,None
9192
92- def add_search_item (self , customer_id , item_array ):
93+ def add_search_item (self , customer_id , item_array , item_name ):
9394 print (f"\n Adding search items for Customer ID: { customer_id } " )
9495 item_suggested = []
9596 item_suggested_score = []
@@ -123,7 +124,7 @@ def add_search_item(self, customer_id, item_array):
123124 item_suggested .append (item_id )
124125 item_suggested_score .append (item .score )
125126
126- self .add_search_result (item_suggested , item_suggested_score , customer_id )
127+ self .add_search_result (item_suggested , item_suggested_score , customer_id , item_name )
127128 self .add_purchase (item_id ,customer_id )
128129
129130
0 commit comments