utkarsh134 commited on
Commit
e529d7d
·
verified ·
1 Parent(s): 03c6646

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -0
main.py CHANGED
@@ -64,6 +64,10 @@ async def process_image(
64
  finding_14kt = round(finding_14kt + finding_markup_value, 2)
65
  finding_18kt = round(finding_18kt + finding_markup_value, 2)
66
  finding_plt = round(finding_plt + finding_markup_value, 2)
 
 
 
 
67
 
68
  metal_data.update({
69
  "Finding For Gold 14KT": finding_14kt,
@@ -82,6 +86,9 @@ async def process_image(
82
  # Ensure the markup value is properly applied
83
  metal_data["Gold Value 14K"] = round(metal_data["Gold Value 14K"] + gold_markup_value, 2)
84
  metal_data["Gold Value 18K"] = round(metal_data["Gold Value 18K"] + gold_markup_value, 2)
 
 
 
85
 
86
  # Apply markup to platinum values - only percentage or fixed
87
  if platinum_markup_type == "percentage":
@@ -90,6 +97,8 @@ async def process_image(
90
  elif platinum_markup_type == "fixed":
91
  # Ensure the markup value is properly applied
92
  metal_data["Plat Value"] = round(metal_data["Plat Value"] + platinum_markup_value, 2)
 
 
93
 
94
  # Apply markup to diamond values - only percentage or fixed
95
  if diamond_markup_type == "percentage":
@@ -100,6 +109,9 @@ async def process_image(
100
  # Ensure the markup value is properly applied for each diamond
101
  for diamond in diamonds:
102
  diamond["Diamond Value"] = round(diamond["Diamond Value"] + diamond_markup_value, 2)
 
 
 
103
 
104
  # Recalculate diamond_values_sum after applying markup
105
  diamond_values_sum = sum(diamond["Diamond Value"] for diamond in diamonds)
 
64
  finding_14kt = round(finding_14kt + finding_markup_value, 2)
65
  finding_18kt = round(finding_18kt + finding_markup_value, 2)
66
  finding_plt = round(finding_plt + finding_markup_value, 2)
67
+ elif finding_markup_type == "times":
68
+ finding_14kt = round(finding_14kt * finding_markup_value, 2)
69
+ finding_18kt = round(finding_18kt * finding_markup_value, 2)
70
+ finding_plt = round(finding_plt * finding_markup_value, 2)
71
 
72
  metal_data.update({
73
  "Finding For Gold 14KT": finding_14kt,
 
86
  # Ensure the markup value is properly applied
87
  metal_data["Gold Value 14K"] = round(metal_data["Gold Value 14K"] + gold_markup_value, 2)
88
  metal_data["Gold Value 18K"] = round(metal_data["Gold Value 18K"] + gold_markup_value, 2)
89
+ elif gold_markup_type == "times":
90
+ metal_data["Gold Value 14K"] = round(metal_data["Gold Value 14K"] * gold_markup_value, 2)
91
+ metal_data["Gold Value 18K"] = round(metal_data["Gold Value 18K"] * gold_markup_value, 2)
92
 
93
  # Apply markup to platinum values - only percentage or fixed
94
  if platinum_markup_type == "percentage":
 
97
  elif platinum_markup_type == "fixed":
98
  # Ensure the markup value is properly applied
99
  metal_data["Plat Value"] = round(metal_data["Plat Value"] + platinum_markup_value, 2)
100
+ elif platinum_markup_type == "times":
101
+ metal_data["Plat Value"] = round(metal_data["Plat Value"] * platinum_markup_value, 2)
102
 
103
  # Apply markup to diamond values - only percentage or fixed
104
  if diamond_markup_type == "percentage":
 
109
  # Ensure the markup value is properly applied for each diamond
110
  for diamond in diamonds:
111
  diamond["Diamond Value"] = round(diamond["Diamond Value"] + diamond_markup_value, 2)
112
+ elif diamond_markup_type == "times":
113
+ for diamond in diamonds:
114
+ diamond["Diamond Value"] = round(diamond["Diamond Value"] * diamond_markup_value, 2)
115
 
116
  # Recalculate diamond_values_sum after applying markup
117
  diamond_values_sum = sum(diamond["Diamond Value"] for diamond in diamonds)