Commit 47eee4d7 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

a bit optimization.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30449 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 36f6524c
......@@ -84,8 +84,9 @@ class FIFO(DeliverySolver):
"""
Returns a list of simulation movement sorted from the last order.
"""
simulation_movement_list = self.simulation_movement_list[:]
simulation_movement_list = self.simulation_movement_list
if len(simulation_movement_list) > 1:
simulation_movement_list.sort(
return sorted(simulation_movement_list,
key=lambda x:x.getExplainationValue().getStartDate(), reverse=True)
return simulation_movement_list
else:
return simulation_movement_list
......@@ -47,8 +47,9 @@ class LIFO(FIFO):
"""
Returns a list of simulation movement sorted from the first order.
"""
simulation_movement_list = self.simulation_movement_list[:]
simulation_movement_list = self.simulation_movement_list
if len(simulation_movement_list) > 1:
simulation_movement_list.sort(
return sorted(simulation_movement_list,
key=lambda x:x.getExplainationValue().getStartDate())
return simulation_movement_list
else:
return simulation_movement_list
......@@ -72,7 +72,8 @@ class MinPrice(FIFO):
"""
Returns a list of simulation movement sorted from the lower price.
"""
simulation_movement_list = self.simulation_movement_list[:]
simulation_movement_list = self.simulation_movement_list
if len(simulation_movement_list) > 1:
simulation_movement_list.sort(key=lambda x:x.getPrice())
return simulation_movement_list
return sorted(simulation_movement_list, key=lambda x:x.getPrice())
else:
return simulation_movement_list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment