|
|
@@ -1436,13 +1436,20 @@ export class TaskService implements OnModuleInit {
|
|
|
const pendingCount = counts.pending || 0
|
|
|
const idleCount = counts.idle || 0
|
|
|
const finish = pendingCount === 0 && idleCount === 0
|
|
|
+
|
|
|
+ // 送达率
|
|
|
+ const deliveryCount = await this.taskItemRepository.countBy({ taskId: task.id, delivery: 1 })
|
|
|
+
|
|
|
const data: Partial<Task> = {
|
|
|
sent: successCount + failCount,
|
|
|
successCount: successCount,
|
|
|
successRate:
|
|
|
successCount + failCount > 0
|
|
|
? ((successCount / (successCount + failCount)) * 100).toFixed(1) + '%'
|
|
|
- : '0%'
|
|
|
+ : '0%',
|
|
|
+ deliveryCount: deliveryCount,
|
|
|
+ deliveryRate:
|
|
|
+ deliveryCount > 0 ? ((deliveryCount / (successCount + failCount)) * 100).toFixed(1) + '%' : '0%'
|
|
|
}
|
|
|
if (finish) {
|
|
|
data.status = TaskStatus.COMPLETED
|