fix(autocall): самовывоз пишет только pickup_date
Решение владельца: у самовывоза дата живёт в pickup_date + pickup_time_slot, delivery_date/delivery_time робот не трогает (раньше дублировал в оба поля, и дата самовывоза всплывала в полях доставки). Маркер «согласовано роботом» общий — delivery_date_source='autocall': по нему работают карточка, фильтры и SQL-статус autocall_status(og); отдельного pickup_date_source в схеме нет. Проверено на боевой функции временными группами с метками в датах: самовывоз — pickup_date обновился, delivery_date остался нетронутым; доставка — delivery_date обновился, pickup_date нетронут. Временные группы удалены. Исторический дубль (единственный: ТП-010747) очищен — дата осталась в pickup_date.
This commit is contained in:
parent
7e719e6b43
commit
ece302d512
|
|
@ -196,16 +196,22 @@ Deno.serve(async (request) => {
|
||||||
delivery_date_source: "autocall",
|
delivery_date_source: "autocall",
|
||||||
delivery_status: "agreed",
|
delivery_status: "agreed",
|
||||||
notification_status: "confirmed",
|
notification_status: "confirmed",
|
||||||
delivery_date: deliveryDate,
|
|
||||||
called: true,
|
called: true,
|
||||||
called_at: new Date().toISOString(),
|
called_at: new Date().toISOString(),
|
||||||
called_comment: comment,
|
called_comment: comment,
|
||||||
next_notification_check_at: null,
|
next_notification_check_at: null,
|
||||||
};
|
};
|
||||||
if (timeSlot) update.delivery_time = timeSlot;
|
// Самовывоз и доставка живут в РАЗНЫХ полях (решение владельца): для
|
||||||
|
// самовывоза пишем только pickup_date + половину дня, delivery_date не
|
||||||
|
// трогаем — иначе дата дублируется в двух полях и всплывает в плане
|
||||||
|
// доставки. Маркер «согласовано роботом» общий — delivery_date_source,
|
||||||
|
// по нему работают и карточка, и SQL-статус autocall_status(og).
|
||||||
if (isPickup) {
|
if (isPickup) {
|
||||||
update.pickup_date = deliveryDate;
|
update.pickup_date = deliveryDate;
|
||||||
if (timeSlot) update.pickup_time_slot = timeSlot;
|
if (timeSlot) update.pickup_time_slot = timeSlot;
|
||||||
|
} else {
|
||||||
|
update.delivery_date = deliveryDate;
|
||||||
|
if (timeSlot) update.delivery_time = timeSlot;
|
||||||
}
|
}
|
||||||
await supabase.from("order_groups").update(update).eq("id", orderGroupId);
|
await supabase.from("order_groups").update(update).eq("id", orderGroupId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue