- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
def filter_goods(items, date_registered_from=0, date_registered_to=99999999999, from_finished_entries=0, to_finished_entries=99999, views_from=0, views_to=999999, activeGoodsFrom=0, activeGoodsTo=999999, delete_no_delivery=False, delete_comapnies=False, delete_duplicates=False, published_later_then=0):
ids = []
q = Queue()
for i in items:
if i[0]['date_created'] >= published_later_then:
if i[1]['date_registered'] >= date_registered_from:
if i[1]['date_registered'] <= date_registered_to:
if i[1]['prods_sold_cnt'] >= from_finished_entries:
if i[1]['prods_sold_cnt'] <= to_finished_entries:
if i[0]['views'] >= views_from:
if i[0]['views'] <= views_to:
if i[1]['prods_active_cnt'] >= activeGoodsFrom:
if i[1]['prods_active_cnt'] <= activeGoodsTo:
if delete_no_delivery:
if i[0]['delivery_enabled'] or delete_no_delivery == False:
if not (delete_comapnies and i[1]['type'] == 'person'):
if delete_comapnies == False:
if delete_duplicates:
if i[0]['owner']['id'] not in ids:
ids.append(i[0]['owner']['id'])
q.put(i[0]['id'])
else:
q.put(i[0]['id'])
return q
Стояла задача написать самый длинный if? Человек не знает про and? Этого мы никогда не узнаем.