Commit 1332af34 by Aeolus

update

parent c7cc1039
...@@ -44,7 +44,7 @@ def create_rent(): ...@@ -44,7 +44,7 @@ def create_rent():
return jsonify(MACHINE_NOT_EXIST_ERROR) return jsonify(MACHINE_NOT_EXIST_ERROR)
total_fee = 0 total_fee = 0
open_hatchs = [] open_hatchs = {}
for id, count in productions.items(): for id, count in productions.items():
count = int(count) count = int(count)
id = int(id) id = int(id)
...@@ -58,12 +58,11 @@ def create_rent(): ...@@ -58,12 +58,11 @@ def create_rent():
left_count = count left_count = count
for i in hatch_list: for i in hatch_list:
if i.left_count <= left_count: if i.left_count <= left_count:
hatch_no_dict = {str(i.hatch_no): i.left_count} open_hatchs[str(i.hatch_no)] = i.left_count
left_count = left_count - i.left_count left_count = left_count - i.left_count
else: else:
hatch_no_dict = {str(i.hatch_no): left_count} open_hatchs[str(i.hatch_no)] = left_count
left_count = 0 left_count = 0
open_hatchs.append(hatch_no_dict)
if left_count <= 0: if left_count <= 0:
break break
if left_count > 0: if left_count > 0:
......
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