Widget Devoir Finition
This commit is contained in:
parent
f0c5ef2be3
commit
243e88f398
@ -105,7 +105,8 @@ export async function GET(request: NextRequest) {
|
||||
const taskStatus = task.status;
|
||||
if (taskStatus !== null && taskStatus !== undefined) {
|
||||
const statusNum = typeof taskStatus === 'string' ? parseInt(taskStatus, 10) : taskStatus;
|
||||
if (statusNum === 5 || taskStatus === '5' || taskStatus === 'Done' || taskStatus === 'done' || taskStatus === 'DONE') {
|
||||
// In Leantime: status 3 = DONE, also check status 5
|
||||
if (statusNum === 3 || statusNum === 5 || taskStatus === '3' || taskStatus === '5' || taskStatus === 'Done' || taskStatus === 'done' || taskStatus === 'DONE') {
|
||||
logger.debug('[LEANTIME_TASKS] Filtering out done task from cache', {
|
||||
id: task.id,
|
||||
headline: task.headline,
|
||||
@ -206,13 +207,15 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
const tasks = data.result
|
||||
.filter((task: any) => {
|
||||
// Filter out any task (main or subtask) that has status Done (5)
|
||||
// Filter out any task (main or subtask) that has status Done
|
||||
// In Leantime: status 3 = DONE (see status-labels/route.ts)
|
||||
// Also check for status 5 as fallback
|
||||
// Handle both number and string formats, and check for null/undefined
|
||||
const taskStatus = task.status;
|
||||
if (taskStatus !== null && taskStatus !== undefined) {
|
||||
const statusNum = typeof taskStatus === 'string' ? parseInt(taskStatus, 10) : taskStatus;
|
||||
const statusStr = typeof taskStatus === 'string' ? taskStatus.trim().toLowerCase() : String(taskStatus).trim().toLowerCase();
|
||||
const isDone = statusNum === 5 || statusStr === '5' || statusStr === 'done';
|
||||
const isDone = statusNum === 3 || statusNum === 5 || statusStr === '3' || statusStr === '5' || statusStr === 'done';
|
||||
|
||||
if (isDone) {
|
||||
logger.debug('[LEANTIME_TASKS] Filtering out done task', {
|
||||
|
||||
@ -231,14 +231,15 @@ export function Duties() {
|
||||
const todayDay = now.getDate();
|
||||
|
||||
const filteredTasks = allTasks.filter((task: Task) => {
|
||||
// Exclude tasks with status Done (5) - check both number and string formats
|
||||
// Exclude tasks with status Done
|
||||
// In Leantime: status 3 = DONE (see api/leantime/status-labels/route.ts), also check status 5
|
||||
const rawStatus = (task as any).status; // Use any to handle potential string/number mismatch
|
||||
if (rawStatus === null || rawStatus === undefined) {
|
||||
// If status is null/undefined, keep the task (let other filters handle it)
|
||||
} else {
|
||||
const taskStatus = typeof rawStatus === 'string' ? parseInt(rawStatus, 10) : rawStatus;
|
||||
const statusStr = typeof rawStatus === 'string' ? rawStatus.toLowerCase() : String(rawStatus).toLowerCase();
|
||||
if (taskStatus === 5 || statusStr === '5' || statusStr === 'done') {
|
||||
if (taskStatus === 3 || taskStatus === 5 || statusStr === '3' || statusStr === '5' || statusStr === 'done') {
|
||||
console.log('[Devoirs Widget] Filtering out done task:', {
|
||||
id: task.id,
|
||||
headline: task.headline,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user