@@ -113,14 +113,34 @@ def menus_transaction(crawled_meals, cursor):
113
113
db_menus = cursor .fetchall ()
114
114
new_menus , deleted_menus , edited_menus = compare_menus (db_menus , crawled_meals , restaurants )
115
115
116
+ # 원본 코드
117
+ # if deleted_menus:
118
+ # deleted_menus_id = [str(menu.get("id")) for menu in deleted_menus]
119
+ # delete_menus_query = f"""
120
+ # DELETE FROM menu
121
+ # WHERE id in ({','.join(deleted_menus_id)});
122
+ # """
123
+ # cursor.execute(delete_menus_query)
124
+ # send_deleted_menus_message(deleted_menus)
125
+ #
126
+
127
+ # 축제용 수정된 코드 (prod 전용)
128
+ # 축제 기간 (5/13 ~ 5/15) 종료 후 삭제
116
129
if deleted_menus :
117
- deleted_menus_id = [str (menu .get ("id" )) for menu in deleted_menus ]
118
- delete_menus_query = f"""
119
- DELETE FROM menu
120
- WHERE id in ({ ',' .join (deleted_menus_id )} );
121
- """
122
- cursor .execute (delete_menus_query )
123
- send_deleted_menus_message (deleted_menus )
130
+ deleted_menus_id = []
131
+ for menu in deleted_menus :
132
+ restaurant_id = menu .get ("restaurant_id" )
133
+ if restaurant_id >= 235 and restaurant_id <= 249 :
134
+ continue
135
+ deleted_menus_id .append (str (menu .get ("id" )))
136
+
137
+ if deleted_menus_id :
138
+ delete_menus_query = f"""
139
+ DELETE FROM menu
140
+ WHERE id in ({ ',' .join (deleted_menus_id )} );
141
+ """
142
+ cursor .execute (delete_menus_query )
143
+ send_deleted_menus_message (deleted_menus )
124
144
125
145
insert_menus_query = """
126
146
INSERT INTO menu(restaurant_id, code, date, type, name_kr, price, etc)
0 commit comments