Widget Devoir Finition
This commit is contained in:
parent
245c9c97ee
commit
f0c5ef2be3
@ -157,31 +157,64 @@ export function Duties() {
|
|||||||
const leantimeStatusDetails = leantimeTasks.map((t: Task) => {
|
const leantimeStatusDetails = leantimeTasks.map((t: Task) => {
|
||||||
const rawStatus = (t as any).status;
|
const rawStatus = (t as any).status;
|
||||||
const statusNum = typeof rawStatus === 'string' ? parseInt(rawStatus, 10) : rawStatus;
|
const statusNum = typeof rawStatus === 'string' ? parseInt(rawStatus, 10) : rawStatus;
|
||||||
const isDone = statusNum === 5 || (typeof rawStatus === 'string' && rawStatus.toLowerCase() === 'done');
|
const statusStr = typeof rawStatus === 'string' ? rawStatus.toLowerCase().trim() : String(rawStatus).toLowerCase().trim();
|
||||||
|
const isDone = statusNum === 5 || statusStr === '5' || statusStr === 'done';
|
||||||
return {
|
return {
|
||||||
id: t.id,
|
id: t.id,
|
||||||
headline: t.headline,
|
headline: t.headline,
|
||||||
status: rawStatus,
|
status: rawStatus,
|
||||||
statusType: typeof rawStatus,
|
statusType: typeof rawStatus,
|
||||||
statusNum,
|
statusNum,
|
||||||
|
statusStr,
|
||||||
isDone,
|
isDone,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const doneTasksCount = leantimeStatusDetails.filter(t => t.isDone).length;
|
// Group by status for better visibility
|
||||||
if (doneTasksCount > 0) {
|
const statusGroups = leantimeStatusDetails.reduce((acc: any, t) => {
|
||||||
console.warn('[Devoirs Widget] ⚠️ Found done tasks in Leantime data:', {
|
const key = String(t.status);
|
||||||
|
if (!acc[key]) {
|
||||||
|
acc[key] = { status: t.status, count: 0, tasks: [] };
|
||||||
|
}
|
||||||
|
acc[key].count++;
|
||||||
|
if (acc[key].tasks.length < 3) {
|
||||||
|
acc[key].tasks.push({ id: t.id, headline: t.headline });
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const doneTasks = leantimeStatusDetails.filter(t => t.isDone);
|
||||||
|
|
||||||
|
// Always log status breakdown for debugging
|
||||||
|
console.log('[Devoirs Widget] 📊 Status Breakdown:', {
|
||||||
|
totalTasks: leantimeTasks.length,
|
||||||
|
statusGroups: Object.keys(statusGroups).map(key => ({
|
||||||
|
status: key,
|
||||||
|
count: statusGroups[key].count,
|
||||||
|
sample: statusGroups[key].tasks,
|
||||||
|
})),
|
||||||
|
doneTasksCount: doneTasks.length,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (doneTasks.length > 0) {
|
||||||
|
console.error('[Devoirs Widget] ❌❌❌ FOUND DONE TASKS - THEY SHOULD BE FILTERED ❌❌❌', {
|
||||||
total: leantimeTasks.length,
|
total: leantimeTasks.length,
|
||||||
doneCount: doneTasksCount,
|
doneCount: doneTasks.length,
|
||||||
doneTasks: leantimeStatusDetails.filter(t => t.isDone),
|
doneTasks: doneTasks.map(t => ({
|
||||||
|
id: t.id,
|
||||||
|
headline: t.headline,
|
||||||
|
status: t.status,
|
||||||
|
statusType: t.statusType,
|
||||||
|
statusNum: t.statusNum,
|
||||||
|
statusStr: t.statusStr,
|
||||||
|
})),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Combined tasks:', {
|
console.log('[Devoirs Widget] Combined tasks:', {
|
||||||
leantime: leantimeTasks.length,
|
leantime: leantimeTasks.length,
|
||||||
twentyCrm: twentyCrmTasks.length,
|
twentyCrm: twentyCrmTasks.length,
|
||||||
total: allTasks.length,
|
total: allTasks.length,
|
||||||
leantimeStatuses: leantimeStatusDetails,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (allTasks.length === 0) {
|
if (allTasks.length === 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user