feat: update task statistics calculation
- Renamed variables in `getTaskStats` for clarity, changing `completed` to `done` and ensuring `archived` is counted separately. - Added logic to calculate `completed` tasks as the sum of `done` and `archived`, improving task status reporting.
This commit is contained in:
@@ -254,17 +254,19 @@ export class TasksService {
|
|||||||
* Récupère les statistiques des tâches
|
* Récupère les statistiques des tâches
|
||||||
*/
|
*/
|
||||||
async getTaskStats() {
|
async getTaskStats() {
|
||||||
const [total, completed, inProgress, todo, backlog, cancelled, freeze, archived] = await Promise.all([
|
const [total, done, archived, inProgress, todo, backlog, cancelled, freeze] = await Promise.all([
|
||||||
prisma.task.count(),
|
prisma.task.count(),
|
||||||
prisma.task.count({ where: { status: 'done' } }),
|
prisma.task.count({ where: { status: 'done' } }),
|
||||||
|
prisma.task.count({ where: { status: 'archived' } }),
|
||||||
prisma.task.count({ where: { status: 'in_progress' } }),
|
prisma.task.count({ where: { status: 'in_progress' } }),
|
||||||
prisma.task.count({ where: { status: 'todo' } }),
|
prisma.task.count({ where: { status: 'todo' } }),
|
||||||
prisma.task.count({ where: { status: 'backlog' } }),
|
prisma.task.count({ where: { status: 'backlog' } }),
|
||||||
prisma.task.count({ where: { status: 'cancelled' } }),
|
prisma.task.count({ where: { status: 'cancelled' } }),
|
||||||
prisma.task.count({ where: { status: 'freeze' } }),
|
prisma.task.count({ where: { status: 'freeze' } })
|
||||||
prisma.task.count({ where: { status: 'archived' } })
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const completed = done + archived; // Terminées = Done + Archived
|
||||||
|
|
||||||
return {
|
return {
|
||||||
total,
|
total,
|
||||||
completed,
|
completed,
|
||||||
|
|||||||
Reference in New Issue
Block a user