Improved: Removed extra unused code to set the fromDate to avoid duplicate PK in case of mysql. As mysql added support to store Fractional Seconds in Time Values, this has been fixed under
@@ -560,15 +560,7 @@ under the License.
<calcop operator="get" field="productAverageCostMap.averageCost"/>
</calculate>
- <!-- ensure that the new ProductAverageCost record has a different PK than the previous one by setting the fromDate to now, plus an offset if needed -->
- <now-timestamp field="nowTimestamp"/>
- <set field="timeDiff" value="${groovy: return nowTimestamp.getTime() - productAverageCost.fromDate.getTime()}" type="Long"/>
- <if-compare field="timeDiff" operator="less-equals" value="1000" type="Long">
- <set-calendar field="productAverageCostMap.fromDate" from-field="nowTimestamp" seconds="+1"/>
- <else>
- <set field="productAverageCostMap.fromDate" from-field="nowTimestamp"/>
- </else>
- </if-compare>
+ <now-timestamp field="productAverageCostMap.fromDate"/>
</else>
</if-empty>
