| Line 136... |
Line 136... |
| 136 |
#stmt = session.query(PrivateDeals).filter_by(isActive=1).filter(now().between(PrivateDeals.startDate, PrivateDeals.endDate)).subquery()
|
136 |
#stmt = session.query(PrivateDeals).filter_by(isActive=1).filter(now().between(PrivateDeals.startDate, PrivateDeals.endDate)).subquery()
|
| 137 |
#query = session.query(Item, privateDealAlias.dealPrice).outerjoin((privateDealAlias, Item.id==privateDealAlias.item_id)).filter(Item.status != status.PHASED_OUT)
|
137 |
#query = session.query(Item, privateDealAlias.dealPrice).outerjoin((privateDealAlias, Item.id==privateDealAlias.item_id)).filter(Item.status != status.PHASED_OUT)
|
| 138 |
tuples = session.query(Tag_Listing, Item).join((Item, Item.id==Tag_Listing.item_id)).filter(or_(Item.status==status.ACTIVE, Item.status==status.PAUSED_BY_RISK, Item.status==status.PARTIALLY_ACTIVE))
|
138 |
tuples = session.query(Tag_Listing, Item).join((Item, Item.id==Tag_Listing.item_id)).filter(or_(Item.status==status.ACTIVE, Item.status==status.PAUSED_BY_RISK, Item.status==status.PARTIALLY_ACTIVE))
|
| 139 |
projection={'defaultImageUrl':1}
|
139 |
projection={'defaultImageUrl':1}
|
| 140 |
for tag, item in tuples:
|
140 |
for tag, item in tuples:
|
| 141 |
if item.brand == "Live Demo":
|
141 |
if item.brand == "Live Demo" or not tag.active:
|
| 142 |
continue
|
142 |
continue
|
| 143 |
if tag.active and not catalogMap.has_key(item.catalog_item_id):
|
143 |
if not catalogMap.has_key(item.catalog_item_id):
|
| 144 |
catalogObj = {}
|
144 |
catalogObj = {}
|
| 145 |
catalogObj['feature'] = ""
|
145 |
catalogObj['feature'] = ""
|
| 146 |
catalogObj['title'] = " ".join(filter(None, [item.brand, item.model_name, item.model_number]))
|
146 |
catalogObj['title'] = " ".join(filter(None, [item.brand, item.model_name, item.model_number]))
|
| 147 |
catalogObj['brand'] = (item.brand)
|
147 |
catalogObj['brand'] = (item.brand)
|
| 148 |
if item.brand == 'Huawei' or item.brand == 'Honor':
|
148 |
if item.brand == 'Huawei' or item.brand == 'Honor':
|
| Line 176... |
Line 176... |
| 176 |
|
176 |
|
| 177 |
catalogObj = catalogMap.get(item.catalog_item_id)
|
177 |
catalogObj = catalogMap.get(item.catalog_item_id)
|
| 178 |
|
178 |
|
| 179 |
if tag.hot_deals:
|
179 |
if tag.hot_deals:
|
| 180 |
catalogObj['hot_deals'] = "True"
|
180 |
catalogObj['hot_deals'] = "True"
|
| 181 |
|
- |
|
| 182 |
if not catalogObj['items'].has_key(item.id):
|
181 |
if not catalogObj['items'].has_key(item.id):
|
| 183 |
catalogObj['items'][item.id] = {'color': item.color.replace("f_", ""), 'tagPricing':[]}
|
182 |
catalogObj['items'][item.id] = {'color': item.color.replace("f_", ""), 'tagPricing':[]}
|
| 184 |
|
183 |
|
| 185 |
itemMap = catalogObj['items'].get(item.id)
|
184 |
itemMap = catalogObj['items'].get(item.id)
|
| 186 |
itemMap['tagPricing'].append(tag)
|
185 |
itemMap['tagPricing'].append(tag)
|
| Line 199... |
Line 198... |
| 199 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'],'hot_deals_b':catalogMap['hot_deals'],
|
198 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'],'hot_deals_b':catalogMap['hot_deals'],
|
| 200 |
'_childDocuments_':itemObjs,
|
199 |
'_childDocuments_':itemObjs,
|
| 201 |
'catalogId_i':catalogId, 'imageUrl_s': catalogMap['imageUrl'], 'feature_s':catalogMap['feature'],
|
200 |
'catalogId_i':catalogId, 'imageUrl_s': catalogMap['imageUrl'], 'feature_s':catalogMap['feature'],
|
| 202 |
'brand_ss': catalogMap['brand'], 'create_s':catalogMap['create_timestamp'], 'categoryId_i':catalogMap['categoryId'], 'subCategoryId_i':catalogMap['subCategoryId']}
|
201 |
'brand_ss': catalogMap['brand'], 'create_s':catalogMap['create_timestamp'], 'categoryId_i':catalogMap['categoryId'], 'subCategoryId_i':catalogMap['subCategoryId']}
|
| 203 |
print catalogObj
|
202 |
print catalogObj
|
| 204 |
catalogObjs.append(catalogObj)
|
203 |
catalogObjs.append(catalogObj)t
|
| 205 |
solr.delete(q='*:*')
|
204 |
solr.delete(q='*:*')
|
| 206 |
solr.add(catalogObjs)
|
205 |
solr.add(catalogObjs)
|
| 207 |
|
206 |
|
| 208 |
|
207 |
|
| 209 |
|
208 |
|