diff --git a/route_sql/addmonth_vd.sql b/route_sql/addmonth_vd.sql index 5c8b2d6..4abab76 100644 --- a/route_sql/addmonth_vd.sql +++ b/route_sql/addmonth_vd.sql @@ -174,7 +174,7 @@ target AS (select target_increment incr) _month ,seq ,promo - ,round((dom_wa/value_usd)::numeric,0)::int odom + ,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom ,round((rlag_wa/value_usd)::numeric,0)::int rlag ,round((slag_wa/value_usd)::numeric,0)::int slag ,value_usd/sum(value_usd) over (partition by _month) momix @@ -575,4 +575,4 @@ GROUP BY ,version ,iter ) -SELECT json_agg(row_to_json(insagg)) x from insagg \ No newline at end of file +SELECT json_agg(row_to_json(insagg)) x from insagg diff --git a/route_sql/addmonth_vupd.sql b/route_sql/addmonth_vupd.sql index 88fb2b9..fb9e9fa 100644 --- a/route_sql/addmonth_vupd.sql +++ b/route_sql/addmonth_vupd.sql @@ -169,7 +169,7 @@ target AS (select target_volume vincr, target_price pincr) _month ,seq ,promo - ,round((dom_wa/value_usd)::numeric,0)::int odom + ,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom ,round((rlag_wa/value_usd)::numeric,0)::int rlag ,round((slag_wa/value_usd)::numeric,0)::int slag ,value_usd/sum(value_usd) over (partition by _month) momix diff --git a/route_sql/new_basket.sql b/route_sql/new_basket.sql index c4ed2f7..945ec1c 100644 --- a/route_sql/new_basket.sql +++ b/route_sql/new_basket.sql @@ -247,7 +247,7 @@ target AS (select $$replace_request$$::json def) _month ,seq ,promo - ,round((dom_wa/value_usd)::numeric,0)::int odom + ,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom ,round((rlag_wa/value_usd)::numeric,0)::int rlag ,round((slag_wa/value_usd)::numeric,0)::int slag ,value_usd/sum(value_usd) over (partition by _month) momix