Dang it, use datetime instead of date, for that sorting hack

This commit is contained in:
Lance Edgar 2020-03-31 23:11:46 -05:00
parent d00e3b6312
commit 4a03a7f57d

View file

@ -119,7 +119,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
super(InventoryItemImporter, self).setup() super(InventoryItemImporter, self).setup()
# this is used for sorting, when a value has no date # this is used for sorting, when a value has no date
self.old_date = datetime.date(1900, 1, 1) self.old_datetime = datetime.datetime(1900, 1, 1)
self.ignored_upcs = self.config.getlist( self.ignored_upcs = self.config.getlist(
'corepos', 'exporting.catapult_inventory.ignored_upcs') 'corepos', 'exporting.catapult_inventory.ignored_upcs')
@ -345,7 +345,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo
product.upc, len(vendor_items), product) product.upc, len(vendor_items), product)
# sort the list so most recently modified is first # sort the list so most recently modified is first
vendor_items.sort(key=lambda item: item.modified or self.old_date, vendor_items.sort(key=lambda item: item.modified or self.old_datetime,
reverse=True) reverse=True)
# use the "first" vendor item available # use the "first" vendor item available