mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 07:08:18 +00:00
Generate missing ticket and payment report currency updates
This commit is contained in:
@@ -111,7 +111,22 @@ export default function TicketsPage() {
|
||||
});
|
||||
|
||||
const generateMissingMutation = useMutation({
|
||||
mutationFn: () => ticketsApi.generateMissing(),
|
||||
mutationFn: async () => {
|
||||
let totalGenerated = 0;
|
||||
let totalFailed = 0;
|
||||
let totalProcessed = 0;
|
||||
let remaining = 1;
|
||||
|
||||
while (remaining > 0) {
|
||||
const result: any = await ticketsApi.generateMissing(10);
|
||||
totalGenerated += result.generated ?? 0;
|
||||
totalFailed += result.failed ?? 0;
|
||||
totalProcessed += result.processed ?? 0;
|
||||
remaining = result.remaining ?? 0;
|
||||
}
|
||||
|
||||
return { generated: totalGenerated, processed: totalProcessed, failed: totalFailed };
|
||||
},
|
||||
onSuccess: (result: any) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['tickets'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['bookings-missing-tickets'] });
|
||||
|
||||
Reference in New Issue
Block a user