fix: require completed photo review before pdf render
This commit is contained in:
@@ -28,8 +28,10 @@ export interface ReportPayload {
|
||||
export function isDecisionGradeReportPayload(payload: ReportPayload): boolean {
|
||||
const decision = String(payload.verdict?.decision || "").trim().toLowerCase();
|
||||
const fairValueRange = String(payload.verdict?.fairValueRange || "").trim().toLowerCase();
|
||||
const photoReviewStatus = String(payload.photoReview?.status || "").trim().toLowerCase();
|
||||
if (!decision || decision === "pending") return false;
|
||||
if (!fairValueRange || fairValueRange === "not established") return false;
|
||||
if (photoReviewStatus !== "completed") return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,7 +81,7 @@ export function validateReportPayload(payload: ReportPayload): string[] {
|
||||
}
|
||||
if (!isDecisionGradeReportPayload(payload)) {
|
||||
throw new ReportValidationError(
|
||||
"The report payload is still preliminary. Stop and complete the decision-grade analysis before generating or sending the property assessment PDF."
|
||||
"The report payload is still preliminary. Stop and complete the decision-grade analysis, including subject-unit photo review, before generating or sending the property assessment PDF."
|
||||
);
|
||||
}
|
||||
return recipients;
|
||||
|
||||
Reference in New Issue
Block a user