bugfix
This commit is contained in:
parent
3df6c1514e
commit
06c2e0b925
@ -123,9 +123,9 @@ def get_unit_value_price(sc, pricingtab):
|
|||||||
pt.specvalue = None
|
pt.specvalue = None
|
||||||
if sc.spec_name == pt.specname and \
|
if sc.spec_name == pt.specname and \
|
||||||
sc.spec_value == pt.specvalue:
|
sc.spec_value == pt.specvalue:
|
||||||
print(f'found {sc.spec_name=},{sc.spec_value=}')
|
# print(f'found {sc.spec_name=},{sc.spec_value=}')
|
||||||
return pt.unit_value, pt.unit_amt
|
return pt.unit_value, pt.unit_amt
|
||||||
print(f'{sc.spec_name=},{sc.spec_value=}:{pt.specname=},{pt.specvalue=}')
|
# print(f'{sc.spec_name=},{sc.spec_value=}:{pt.specname=},{pt.specvalue=}')
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
async def calc_prod_price(sor, productid, spec_config):
|
async def calc_prod_price(sor, productid, spec_config):
|
||||||
@ -160,7 +160,7 @@ where a.id=${productid}$
|
|||||||
raise e
|
raise e
|
||||||
price = 0.0
|
price = 0.0
|
||||||
for sc in spec_config:
|
for sc in spec_config:
|
||||||
print(f'{sc=}, {recs=}')
|
# print(f'{sc=}, {recs=}')
|
||||||
uv, up = get_unit_value_price(sc, recs)
|
uv, up = get_unit_value_price(sc, recs)
|
||||||
if uv is None:
|
if uv is None:
|
||||||
continue
|
continue
|
||||||
|
@ -3,16 +3,17 @@ from appPublic.dictObject import DictObject
|
|||||||
from platformbiz.pricing import calc_prod_price
|
from platformbiz.pricing import calc_prod_price
|
||||||
|
|
||||||
async def test(sor):
|
async def test(sor):
|
||||||
prodid = 'a--akNeu1Ia-NOZAJAadf'
|
# prodid = 'a--akNeu1Ia-NOZAJAadf'
|
||||||
|
prodid = 'MT-k34zPUAuWqgov4QCmG'
|
||||||
spec_config = [
|
spec_config = [
|
||||||
DictObject(**{
|
DictObject(**{
|
||||||
"spec_name":"input_tokens",
|
"spec_name":"input_tokens",
|
||||||
"count":12832
|
"count":12832
|
||||||
}),
|
})#,
|
||||||
DictObject(**{
|
#DictObject(**{
|
||||||
"spec_name":"output_tokens",
|
# "spec_name":"output_tokens",
|
||||||
"count":786323
|
# "count":786323
|
||||||
})
|
#})
|
||||||
]
|
]
|
||||||
price = await calc_prod_price(sor, prodid, spec_config)
|
price = await calc_prod_price(sor, prodid, spec_config)
|
||||||
print(f'{prodid=}, {spec_config=}, {price=}')
|
print(f'{prodid=}, {spec_config=}, {price=}')
|
||||||
|
Loading…
Reference in New Issue
Block a user