fix(quotes): no-quote letters always flip to approval_pending
The downstream status-flip logic uses ready.length === allItems.length
to choose between approval_pending and partial_approval_pending. For
an is_no_quote quote with all-unpriced items, the unfiltered bypass
in Task 7 made ready.length === 0 while allItems.length > 0, flipping
to partial_approval_pending instead of approval_pending — contradicting
the spec ('new → approval_pending → sending → emailed' for no-quote
letters).
Add a guard so is_no_quote quotes always flip to approval_pending.
The partial-flip path remains unchanged for priced quotes.
This commit is contained in:
parent
cfcbbc5f10
commit
a2e10652a4
1 changed files with 3 additions and 4 deletions
|
|
@ -345,10 +345,9 @@ export async function POST(
|
|||
// Pick partial vs full based on whether every priced item is
|
||||
// ready to send. `ready` is the array of priced, has-supplier
|
||||
// items (defined earlier in the validation block).
|
||||
const targetStatus =
|
||||
ready.length === allItems.length
|
||||
? "approval_pending"
|
||||
: "partial_approval_pending";
|
||||
const targetStatus = !isNoQuote && ready.length !== allItems.length
|
||||
? "partial_approval_pending"
|
||||
: "approval_pending";
|
||||
await pb.collection("quotes").update(quoteId, {
|
||||
status: targetStatus,
|
||||
pdf_generated_at: pdfGeneratedAt,
|
||||
|
|
|
|||
Loading…
Reference in a new issue