Subversion Repositories SmartDukaan

Rev

Rev 14055 | Rev 14071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14055 Rev 14069
Line 92... Line 92...
92
    collection = get_mongo_connection().Catalog.SkuSchemeDetails
92
    collection = get_mongo_connection().Catalog.SkuSchemeDetails
93
    data['addedOn'] = to_java_date(datetime.now())
93
    data['addedOn'] = to_java_date(datetime.now())
94
    collection.insert(data)
94
    collection.insert(data)
95
    return {1:"Data added successfully"}
95
    return {1:"Data added successfully"}
96
 
96
 
97
def getAllSkuWiseSchemeDetails():
97
def getAllSkuWiseSchemeDetails(offset, limit):
98
    data = []
98
    data = []
99
    collection = get_mongo_connection().Catalog.SkuSchemeDetails
99
    collection = get_mongo_connection().Catalog.SkuSchemeDetails
100
    cursor = collection.find()
100
    cursor = collection.find()
101
    for val in cursor:
101
    for val in cursor:
-
 
102
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
-
 
103
        if len(master) > 0:
-
 
104
            val['brand'] = master[0]['brand']
-
 
105
            val['source_product_name'] = master[0]['source_product_name']
-
 
106
            val['skuBundleId'] = master[0]['skuBundleId']
-
 
107
        else:
-
 
108
            val['brand'] = ""
-
 
109
            val['source_product_name'] = ""
-
 
110
            val['skuBundleId'] = ""
102
        data.append(val)
111
        data.append(val)
103
    return data
112
    return data
104
 
113
 
105
def addSkuDiscountInfo(data):
114
def addSkuDiscountInfo(data):
106
    collection = get_mongo_connection().Catalog.SkuDiscountInfo
115
    collection = get_mongo_connection().Catalog.SkuDiscountInfo
Line 117... Line 126...
117
    collection = get_mongo_connection().Catalog.SkuDiscountInfo
126
    collection = get_mongo_connection().Catalog.SkuDiscountInfo
118
    cursor = collection.find().skip(offset).limit(limit)
127
    cursor = collection.find().skip(offset).limit(limit)
119
    for val in cursor:
128
    for val in cursor:
120
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
129
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
121
        if len(master) > 0:
130
        if len(master) > 0:
122
            val['brand'] = master['brand']
131
            val['brand'] = master[0]['brand']
123
            val['source_product_name'] = master['source_product_name']
132
            val['source_product_name'] = master[0]['source_product_name']
124
            val['skuBundleId'] = master['skuBundleId']
133
            val['skuBundleId'] = master[0]['skuBundleId']
125
        else:
134
        else:
126
            val['brand'] = ""
135
            val['brand'] = ""
127
            val['source_product_name'] = ""
136
            val['source_product_name'] = ""
128
            val['skuBundleId'] = ""
137
            val['skuBundleId'] = ""
129
        data.append(val)
138
        data.append(val)
Line 154... Line 163...
154
    collection = get_mongo_connection().Catalog.ExceptionalNlc
163
    collection = get_mongo_connection().Catalog.ExceptionalNlc
155
    cursor = collection.find()
164
    cursor = collection.find()
156
    for val in cursor:
165
    for val in cursor:
157
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
166
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
158
        if len(master) > 0:
167
        if len(master) > 0:
159
            val['brand'] = master['brand']
168
            val['brand'] = master[0]['brand']
160
            val['source_product_name'] = master['source_product_name']
169
            val['source_product_name'] = master[0]['source_product_name']
161
            val['skuBundleId'] = master['skuBundleId']
170
            val['skuBundleId'] = master[0]['skuBundleId']
162
        else:
171
        else:
163
            val['brand'] = ""
172
            val['brand'] = ""
164
            val['source_product_name'] = ""
173
            val['source_product_name'] = ""
165
            val['skuBundleId'] = ""
174
            val['skuBundleId'] = ""
166
        data.append(val)
175
        data.append(val)
Line 486... Line 495...
486
    collection = get_mongo_connection().Catalog.SkuDealerPrices
495
    collection = get_mongo_connection().Catalog.SkuDealerPrices
487
    cursor = collection.find().skip(offset).limit(limit)
496
    cursor = collection.find().skip(offset).limit(limit)
488
    for val in cursor:
497
    for val in cursor:
489
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
498
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
490
        if len(master) > 0:
499
        if len(master) > 0:
491
            val['brand'] = master['brand']
500
            val['brand'] = master[0]['brand']
492
            val['source_product_name'] = master['source_product_name']
501
            val['source_product_name'] = master[0]['source_product_name']
493
            val['skuBundleId'] = master['skuBundleId']
502
            val['skuBundleId'] = master[0]['skuBundleId']
494
        else:
503
        else:
495
            val['brand'] = ""
504
            val['brand'] = ""
496
            val['source_product_name'] = ""
505
            val['source_product_name'] = ""
497
            val['skuBundleId'] = ""
506
            val['skuBundleId'] = ""
498
        data.append(val)
507
        data.append(val)