АРЧ АП11 - Архитектура после регресса: Архитектура: сохранить свежую дату при inventory root restore и очистить data-scope ответы от грязных лейблов
This commit is contained in:
@@ -287,10 +287,36 @@ function buildInventoryRootFollowupContext(followupContext) {
|
||||
if (!followupContext || !followupContext.root_intent || !followupContext.root_filters) {
|
||||
return followupContext;
|
||||
}
|
||||
const rootFilters = followupContext.root_filters && typeof followupContext.root_filters === "object"
|
||||
? { ...followupContext.root_filters }
|
||||
: {};
|
||||
const previousFilters = followupContext.previous_filters && typeof followupContext.previous_filters === "object"
|
||||
? followupContext.previous_filters
|
||||
: {};
|
||||
const previousAsOfDate = toNonEmptyString(previousFilters.as_of_date);
|
||||
const previousPeriodFrom = toNonEmptyString(previousFilters.period_from);
|
||||
const previousPeriodTo = toNonEmptyString(previousFilters.period_to);
|
||||
const previousOrganization = toNonEmptyString(previousFilters.organization);
|
||||
const previousWarehouse = toNonEmptyString(previousFilters.warehouse);
|
||||
if (previousAsOfDate) {
|
||||
rootFilters.as_of_date = previousAsOfDate;
|
||||
}
|
||||
if (previousPeriodFrom) {
|
||||
rootFilters.period_from = previousPeriodFrom;
|
||||
}
|
||||
if (previousPeriodTo) {
|
||||
rootFilters.period_to = previousPeriodTo;
|
||||
}
|
||||
if (!toNonEmptyString(rootFilters.organization) && previousOrganization) {
|
||||
rootFilters.organization = previousOrganization;
|
||||
}
|
||||
if (!toNonEmptyString(rootFilters.warehouse) && previousWarehouse) {
|
||||
rootFilters.warehouse = previousWarehouse;
|
||||
}
|
||||
return {
|
||||
...followupContext,
|
||||
previous_intent: followupContext.root_intent,
|
||||
previous_filters: { ...followupContext.root_filters },
|
||||
previous_filters: rootFilters,
|
||||
previous_anchor_type: followupContext.root_anchor_type ?? followupContext.previous_anchor_type,
|
||||
previous_anchor_value: followupContext.root_anchor_value ?? followupContext.previous_anchor_value,
|
||||
current_frame_kind: "inventory_root"
|
||||
|
||||
Reference in New Issue
Block a user