fix: breakdown item rates wrong value
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
parent
009576c841
commit
d5adc48d9b
|
@ -19,6 +19,7 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async afterProcess(): Promise<void> {
|
async afterProcess(): Promise<void> {
|
||||||
|
const period_ids = this.filterParam.season_period_ids;
|
||||||
this.result.data?.map((rates) => {
|
this.result.data?.map((rates) => {
|
||||||
const item = rates['item'];
|
const item = rates['item'];
|
||||||
const item_price =
|
const item_price =
|
||||||
|
@ -28,7 +29,10 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
||||||
|
|
||||||
const bundlings = item?.bundling_items ?? [];
|
const bundlings = item?.bundling_items ?? [];
|
||||||
const bundling_items = bundlings.map((bundling) => {
|
const bundling_items = bundlings.map((bundling) => {
|
||||||
const rate = bundling.item_rates?.[0]?.price ?? 0;
|
const item_rates = bundling.item_rates?.find((rate) => {
|
||||||
|
return period_ids?.includes(rate.season_period_id);
|
||||||
|
});
|
||||||
|
const rate = item_rates?.price ?? 0;
|
||||||
return {
|
return {
|
||||||
...bundling,
|
...bundling,
|
||||||
item_rates: rate,
|
item_rates: rate,
|
||||||
|
@ -77,7 +81,7 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
||||||
'bundling_items.id',
|
'bundling_items.id',
|
||||||
'bundling_items.name',
|
'bundling_items.name',
|
||||||
|
|
||||||
'item_rates.price',
|
'item_rates',
|
||||||
|
|
||||||
`season_period.id`,
|
`season_period.id`,
|
||||||
`season_period.priority`,
|
`season_period.priority`,
|
||||||
|
|
Loading…
Reference in New Issue