Subversion Repositories SmartDukaan

Rev

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

Rev 4934 Rev 4979
Line 25... Line 25...
25
        initialize(dbname, db_hostname)
25
        initialize(dbname, db_hostname)
26
        try:
26
        try:
27
            config_client = ConfigClient()
27
            config_client = ConfigClient()
28
            self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
28
            self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
29
            self.cod_cutoff_time = 0 #int(config_client.get_property('delivery_cutoff_time'))
29
            self.cod_cutoff_time = 0 #int(config_client.get_property('delivery_cutoff_time'))
30
            self.stock_threshold = int(config_client.get_property('inventory_stock_threshold'))
-
 
31
            self.time_to_procure = int(config_client.get_property('inventory_time_to_procure'))
30
            self.time_to_procure = int(config_client.get_property('inventory_time_to_procure'))
32
            self.default_pincode = int(config_client.get_property('default_pincode'))
31
            self.default_pincode = int(config_client.get_property('default_pincode'))
33
        except Exception as ex:
32
        except Exception as ex:
34
            print "[ERROR] Unexpected config error:", sys.exc_info()[0]
33
            print "[ERROR] Unexpected config error:", sys.exc_info()[0]
35
            self.cutoff_time = 15
34
            self.cutoff_time = 15
36
            self.cod_cutoff_time = 0
35
            self.cod_cutoff_time = 0
37
            self.stock_threshold = 2
-
 
38
            self.time_to_procure = 48
36
            self.time_to_procure = 48
39
            self.default_pincode = "110001"
37
            self.default_pincode = "110001"
40
         
38
         
41
    def getProvider(self, providerId):
39
    def getProvider(self, providerId):
42
        """
40
        """
Line 147... Line 145...
147
        the courier agency and is completely within our control (well, almost).
145
        the courier agency and is completely within our control (well, almost).
148
        '''
146
        '''
149
        #Always add the expected delay
147
        #Always add the expected delay
150
        shipping_delay = 24 * expected_delay
148
        shipping_delay = 24 * expected_delay
151
        
149
        
152
        # Increase the estimate if the actual stock is less than the threshold 
-
 
153
        if items_in_inventory < self.stock_threshold :
-
 
154
            shipping_delay = shipping_delay + self.time_to_procure
-
 
155
        
-
 
156
        # Sometimes we set negative shipping delay just in case we know time to procure will be less than the default.
150
        # Sometimes we set negative shipping delay just in case we know time to procure will be less than the default.
157
        # If we have received inventory and forgot to remove expected delay from item, it could lead to display negative shipping days. 
151
        # If we have received inventory and forgot to remove expected delay from item, it could lead to display negative shipping days. 
158
        if shipping_delay < 0:
152
        if shipping_delay < 0:
159
            shipping_delay = 0
153
            shipping_delay = 0
160
            
154