diff --git a/app/api/job/handler/sync-analysis-results.ts b/app/api/job/handler/sync-analysis-results.ts
index c7fd529..c5a2323 100644
--- a/app/api/job/handler/sync-analysis-results.ts
+++ b/app/api/job/handler/sync-analysis-results.ts
@@ -58,5 +58,5 @@ export default async function syncAnalysisResults() {
}
return acc;
}, {} as GroupedResults);
- console.info(`Processed ${processedMessages.length} messages, results: ${JSON.stringify(groupedResults, undefined, 2)}`);
+ console.info(`Processed ${processedMessages.length} messages, results: ${JSON.stringify(groupedResults)}`);
}
diff --git a/app/api/job/handler/sync-connected-online.ts b/app/api/job/handler/sync-connected-online.ts
index 829ba54..39a5fb3 100644
--- a/app/api/job/handler/sync-connected-online.ts
+++ b/app/api/job/handler/sync-connected-online.ts
@@ -71,19 +71,19 @@ export default async function syncConnectedOnline() {
return {
id: service.ID,
clinic_id: service.ClinicID,
- code: service.Code,
- description: service.Description || null,
- display: service.Display,
- duration: service.Duration,
- has_free_codes: !!service.HasFreeCodes,
+ sync_id: service.SyncID,
name: service.Name,
+ description: service.Description || null,
+ price: service.Price,
+ requires_payment: !!service.RequiresPayment,
+ duration: service.Duration,
neto_duration: service.NetoDuration,
+ display: service.Display,
+ price_periods: service.PricePeriods || null,
online_hide_duration: service.OnlineHideDuration,
online_hide_price: service.OnlineHidePrice,
- price: service.Price,
- price_periods: service.PricePeriods || null,
- requires_payment: !!service.RequiresPayment,
- sync_id: service.SyncID,
+ code: service.Code,
+ has_free_codes: !!service.HasFreeCodes,
};
});
diff --git a/app/api/job/test-medipost-responses/route.ts b/app/api/job/test-medipost-responses/route.ts
index 2cf8fa7..4ca8be0 100644
--- a/app/api/job/test-medipost-responses/route.ts
+++ b/app/api/job/test-medipost-responses/route.ts
@@ -16,7 +16,7 @@ export async function POST(request: NextRequest) {
return NextResponse.json({}, { status: 401, statusText: 'Unauthorized' });
}
- const analysisOrders = await getAnalysisOrdersAdmin({ orderStatus: 'QUEUED' });
+ const analysisOrders = await getAnalysisOrdersAdmin({ orderStatus: 'PROCESSING' });
console.error(`Sending test responses for ${analysisOrders.length} analysis orders`);
for (const medreportOrder of analysisOrders) {
diff --git a/app/doctor/_components/analysis-view.tsx b/app/doctor/_components/analysis-view.tsx
index 9a369b1..47033a0 100644
--- a/app/doctor/_components/analysis-view.tsx
+++ b/app/doctor/_components/analysis-view.tsx
@@ -53,6 +53,7 @@ export default function AnalysisView({
feedback?: DoctorFeedback;
}) {
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
+ const [isDraftSubmitting, setIsDraftSubmitting] = useState(false);
const { data: user } = useUser();
@@ -106,28 +107,22 @@ export default function AnalysisView({
};
const handleDraftSubmit = async (e: React.FormEvent) => {
+ setIsDraftSubmitting(true);
e.preventDefault();
form.formState.errors.feedbackValue = undefined;
const formData = form.getValues();
- onSubmit(formData, 'DRAFT');
+ await onSubmit(formData, 'DRAFT');
+ setIsDraftSubmitting(false);
};
- const handleCompleteSubmit = async (e: React.FormEvent) => {
- e.preventDefault();
-
- const isValid = await form.trigger();
- if (!isValid) {
- return;
- }
-
+ const handleCompleteSubmit = form.handleSubmit(async () => {
setIsConfirmOpen(true);
- };
+ });
- const confirmComplete = () => {
- const formData = form.getValues();
- onSubmit(formData, 'COMPLETED');
- };
+ const confirmComplete = form.handleSubmit(async (data) => {
+ await onSubmit(data, 'COMPLETED');
+ });
return (
<>
@@ -179,7 +174,11 @@ export default function AnalysisView({
- {bmiFromMetric(patient?.weight ?? 0, patient?.height ?? 0)}
+
+ {patient?.weight && patient?.height
+ ? bmiFromMetric(patient.weight, patient.height)
+ : '-'}
+
@@ -245,7 +244,9 @@ export default function AnalysisView({
type="button"
variant="outline"
onClick={handleDraftSubmit}
- disabled={isReadOnly}
+ disabled={
+ isReadOnly || isDraftSubmitting || form.formState.isSubmitting
+ }
className="xs:w-1/4 w-full"
>
@@ -253,7 +254,9 @@ export default function AnalysisView({