| Line 161... |
Line 161... |
| 161 |
|
161 |
|
| 162 |
# Increase the estimate if the actual stock is less than the threshold
|
162 |
# Increase the estimate if the actual stock is less than the threshold
|
| 163 |
if items_in_inventory < self.stock_threshold :
|
163 |
if items_in_inventory < self.stock_threshold :
|
| 164 |
shipping_delay = shipping_delay + self.time_to_procure
|
164 |
shipping_delay = shipping_delay + self.time_to_procure
|
| 165 |
|
165 |
|
| - |
|
166 |
# Sometimes we set negative shipping delay just in case we know time to procure will be less than the default.
|
| - |
|
167 |
# If we have received inventory and forgot to remove expected delay from item, it could lead to display negative shipping days.
|
| - |
|
168 |
if shipping_delay < 0:
|
| - |
|
169 |
shipping_delay = 0
|
| - |
|
170 |
|
| 166 |
#Further increase the estimate if it's late in the day
|
171 |
#Further increase the estimate if it's late in the day
|
| 167 |
current_hour = datetime.datetime.now().hour
|
172 |
current_hour = datetime.datetime.now().hour
|
| 168 |
if type == DeliveryType.PREPAID and self.cutoff_time <= current_hour:
|
173 |
if type == DeliveryType.PREPAID and self.cutoff_time <= current_hour:
|
| 169 |
shipping_delay = shipping_delay + 24
|
174 |
shipping_delay = shipping_delay + 24
|
| 170 |
elif type == DeliveryType.COD and self.cod_cutoff_time <= current_hour:
|
175 |
elif type == DeliveryType.COD and self.cod_cutoff_time <= current_hour:
|