Subversion Repositories SmartDukaan

Rev

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

Rev 16283 Rev 16298
Line 518... Line 518...
518
                otherDiv = prodDetailDiv[1]
518
                otherDiv = prodDetailDiv[1]
519
                trackBlock = subOrderElement.find('div',{'class':'trackingDetailsBlock'})
519
                trackBlock = subOrderElement.find('div',{'class':'trackingDetailsBlock'})
520
                findMap = {"orderId": order['orderId'], "subOrders.merchantSubOrderId": merchantSubOrderId}
520
                findMap = {"orderId": order['orderId'], "subOrders.merchantSubOrderId": merchantSubOrderId}
521
                updateMap = {}
521
                updateMap = {}
522
                detailedStatus = otherDiv.find('div',{'class':'orderStatus'}).span.text.strip()
522
                detailedStatus = otherDiv.find('div',{'class':'orderStatus'}).span.text.strip()
523
                updateMap["subOrders.$.detailedStatus"] = detailedStatus
-
 
524
                status = self._getStatusFromDetailedStatus(detailedStatus) 
-
 
525
                closedStatus = status in [Store.ORDER_DELIVERED, Store.ORDER_CANCELLED]
-
 
526
                if status is not None:
523
                
527
                    updateMap["subOrders.$.status"] = status
-
 
528
                if 'A new order placed with a different seller' in str(trackBlock):
524
                if 'A new order placed with a different seller' in str(trackBlock):
529
                    #if it is more than 6hours mark closed.
525
                    #if it is more than 6hours mark closed.
530
                    closeAt = subOrder.get("closeAt") 
526
                    closeAt = subOrder.get("closeAt") 
531
                    if closeAt is None:
527
                    if closeAt is None:
532
                        closeAt = datetime.now() + timedelta(hours=6)
528
                        closeAt = datetime.now() + timedelta(hours=6)
533
                        updateMap["subOrders.$.closeAt"] = datetime.strftime(closeAt,"%Y-%m-%d %H:%M:%S")
529
                        updateMap["subOrders.$.closeAt"] = datetime.strftime(closeAt,"%Y-%m-%d %H:%M:%S")
-
 
530
                        bulk.find(findMap).update({'$set' : updateMap})
-
 
531
                        continue
534
                    else:
532
                    else:
535
                        closeAt = datetime.strptime(closeAt,"%Y-%m-%d %H:%M:%S")
533
                        closeAt = datetime.strptime(closeAt,"%Y-%m-%d %H:%M:%S")
536
                        if datetime.now() > closeAt:
534
                        if datetime.now() > closeAt:
537
                            closedStatus = True
-
 
538
                            updateMap["subOrders.$.status"] = Store.ORDER_CANCELLED
-
 
539
                            updateMap["subOrders.$.detailedStatus"] = 'A new order placed with a different seller'
535
                            detailedStatus = 'A new order placed with a different seller'
540
                        
536
                        
-
 
537
 
-
 
538
                status = self._getStatusFromDetailedStatus(detailedStatus) 
-
 
539
                closedStatus = status in [Store.ORDER_DELIVERED, Store.ORDER_CANCELLED]
-
 
540
                updateMap["subOrders.$.detailedStatus"] = detailedStatus
-
 
541
                if status is not None:
-
 
542
                    updateMap["subOrders.$.status"] = status
541
                        
543
                        
542
                if closedStatus:
544
                if closedStatus:
543
                    #if status is closed then change the paybackStatus accordingly
545
                    #if status is closed then change the paybackStatus accordingly
544
                    updateMap["subOrders.$.closed"] = True
546
                    updateMap["subOrders.$.closed"] = True
545
                    if status == Store.ORDER_DELIVERED:
547
                    if status == Store.ORDER_DELIVERED: