From f94e399cf89aab7cfcbaa340962c93acda312e25 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Oct 2026 00:29:21 +0300 Subject: [PATCH] 041 inmem decimal fix, -m workaround --- Application.cfc | 2 +- mod/MemoryDbHelper.cfc | 3 ++- mod/compute_payg.cfm | 8 ++++---- mod/crm_contract.cfm | 3 ++- mod/new 1.txt | 22 ---------------------- 5 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 mod/new 1.txt diff --git a/Application.cfc b/Application.cfc index 28d8a4c..2216075 100644 --- a/Application.cfc +++ b/Application.cfc @@ -109,7 +109,7 @@ - + diff --git a/mod/MemoryDbHelper.cfc b/mod/MemoryDbHelper.cfc index e5a9676..cf40737 100644 --- a/mod/MemoryDbHelper.cfc +++ b/mod/MemoryDbHelper.cfc @@ -1,4 +1,5 @@ component { + /*0.04 precision fix DECIMAL(128,32) maybe too memory consumable*/ /*0.03 precision fix*/ /*0.02 timestamp support*/ /** @@ -71,7 +72,7 @@ component { case "BIGINT": return "BIGINT"; case "DOUBLE": case "FLOAT": case "REAL": return "DOUBLE"; case "BOOLEAN": case "BIT": return "BIT"; - case "DECIMAL": case "NUMERIC": return "DECIMAL"; + case "DECIMAL": case "NUMERIC": return "DECIMAL(128,32)"; case "TIMESTAMP": case "DATE": case "TIME": return "TIMESTAMP"; default: return "LONGVARCHAR"; // И тут тоже } diff --git a/mod/compute_payg.cfm b/mod/compute_payg.cfm index f39c6e3..0d5578d 100644 --- a/mod/compute_payg.cfm +++ b/mod/compute_payg.cfm @@ -87,7 +87,7 @@ - select s.catalogName as svc, s.component, s.serviceCode as service_code, NULL as sku_code, s.fullCode as code, s.measureShort as unit + select s.catalogName as svc, s.component, s.serviceCode as service_code, s.fullCode as sku_code, s.fullCode as code, s.measureShort as unit , s.priceWVat as price ,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity ,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price @@ -98,7 +98,7 @@ UNION - select s.catalogName as svc, s.component, s.serviceCode as service_code, NULL as sku_code, s.fullCode as code, s.measureShort as unit + select s.catalogName as svc, s.component, s.serviceCode as service_code, s.fullCode as sku_code, s.fullCode as code, s.measureShort as unit , s.priceWVat as price ,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity ,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price @@ -107,9 +107,9 @@ WHERE s.fullCode NOT IN () AND s.serviceType = 3 - + qSpec (Left Outer Join with Free Tier) diff --git a/mod/crm_contract.cfm b/mod/crm_contract.cfm index e32d40a..e8876f9 100644 --- a/mod/crm_contract.cfm +++ b/mod/crm_contract.cfm @@ -97,7 +97,8 @@ priceWVat=local.component.priceWVat, componentDiscount=local.component.discount, atomicCode=local.component.atomicCode, - fullCode="#local.component.componentCode#-#listGetAt('i,f,m',local.service.serviceType)#" + //fullCode="#local.component.componentCode#-#listGetAt('i,f,m',local.service.serviceType)#" + fullCode="#reReplace(local.component.componentCode, '-.$', '')#" //truncate -m garbage }])/> diff --git a/mod/new 1.txt b/mod/new 1.txt deleted file mode 100644 index ae86f15..0000000 --- a/mod/new 1.txt +++ /dev/null @@ -1,22 +0,0 @@ - -SQL SELECT -s.code,m.code as m_code,s.service_code as service_code,s.svc,s.component,s.unit, -s.price*(100-s.discount)/100 as discounted_price -,s.price,s.discount,m.raw_metric,m.metric,s.serviceStart,s.serviceEnd,s.serviceHash,s.serviceCustomName,m.dt,s.free_tier,m.dimension_1,m.dimension_1_name ||'x' as dimension_1_name,m.dimension_2,m.dimension_2_name -FROM qSpec as s, qUnifiedMetric as m -WHERE m.wz='62' -AND s.code=m.code -AND s.serviceStart <= m.dt -AND (m.dt <= s.serviceEnd OR s.serviceEnd IS NULL) - - -UNION ALL -SELECT NULL, m.code, NULL, NULL, NULL, NULL, 0, -NULL, NULL, m.raw_metric, m.metric, NULL, NULL, NULL, NULL, m.dt, 0, m.dimension_1, m.dimension_1_name ||'y', m.dimension_2, m.dimension_2_name -FROM qUnifiedMetric as m where m.code NOT IN ('5','6') - -UNION ALL -SELECT s.code, NULL, s.service_code, s.svc, s.component, s.unit, s.price*(100-s.discount)/100 as discounted_price, -s.price, s.discount, NULL, NULL, s.serviceStart, s.serviceEnd, s.serviceHash, s.serviceCustomName, NULL, 0, NULL, NULL, NULL, NULL -FROM qSpec as s where s.code NOT IN ('5','6') -order by m.dt, m.code, dimension_1, dimension_2 \ No newline at end of file