mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 07:20:12 +01:00
Fix Regression - unable to view cards by due date v8.11.
Thanks to xet7 ! Fixes #5964
This commit is contained in:
parent
8e296231ba
commit
ae11e80bde
6 changed files with 184 additions and 27 deletions
|
|
@ -25,7 +25,7 @@ Meteor.methods({
|
|||
|
||||
for (const board of allBoards) {
|
||||
try {
|
||||
const result = this.fixDuplicateListsForBoard(board._id);
|
||||
const result = fixDuplicateListsForBoard(board._id);
|
||||
totalFixed += result.fixed;
|
||||
totalBoardsProcessed++;
|
||||
|
||||
|
|
@ -55,19 +55,21 @@ Meteor.methods({
|
|||
throw new Meteor.Error('not-authorized');
|
||||
}
|
||||
|
||||
return this.fixDuplicateListsForBoard(boardId);
|
||||
},
|
||||
return fixDuplicateListsForBoard(boardId);
|
||||
}
|
||||
});
|
||||
|
||||
fixDuplicateListsForBoard(boardId) {
|
||||
// Helper functions defined outside of Meteor.methods
|
||||
function fixDuplicateListsForBoard(boardId) {
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(`Fixing duplicate lists for board ${boardId}...`);
|
||||
}
|
||||
|
||||
// First, fix duplicate swimlanes
|
||||
const swimlaneResult = this.fixDuplicateSwimlanes(boardId);
|
||||
const swimlaneResult = fixDuplicateSwimlanes(boardId);
|
||||
|
||||
// Then, fix duplicate lists
|
||||
const listResult = this.fixDuplicateLists(boardId);
|
||||
const listResult = fixDuplicateLists(boardId);
|
||||
|
||||
return {
|
||||
boardId,
|
||||
|
|
@ -75,9 +77,10 @@ Meteor.methods({
|
|||
fixedLists: listResult.fixed,
|
||||
fixed: swimlaneResult.fixed + listResult.fixed
|
||||
};
|
||||
},
|
||||
}
|
||||
|
||||
fixDuplicateSwimlanes(boardId) {
|
||||
// Helper functions defined outside of Meteor.methods
|
||||
function fixDuplicateSwimlanes(boardId) {
|
||||
const swimlanes = Swimlanes.find({ boardId }).fetch();
|
||||
const swimlaneGroups = {};
|
||||
let fixed = 0;
|
||||
|
|
@ -144,9 +147,9 @@ Meteor.methods({
|
|||
});
|
||||
|
||||
return { fixed };
|
||||
},
|
||||
}
|
||||
|
||||
fixDuplicateLists(boardId) {
|
||||
function fixDuplicateLists(boardId) {
|
||||
const lists = Lists.find({ boardId }).fetch();
|
||||
const listGroups = {};
|
||||
let fixed = 0;
|
||||
|
|
@ -192,8 +195,9 @@ Meteor.methods({
|
|||
});
|
||||
|
||||
return { fixed };
|
||||
},
|
||||
}
|
||||
|
||||
Meteor.methods({
|
||||
'fixDuplicateLists.getReport'() {
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('not-authorized');
|
||||
|
|
|
|||
|
|
@ -136,10 +136,29 @@ Meteor.publish('dueCards', function(allUsers = false) {
|
|||
|
||||
// Get user's board memberships for efficient filtering
|
||||
const userBoards = ReactiveCache.getBoards({
|
||||
members: userId
|
||||
$or: [
|
||||
{ permission: 'public' },
|
||||
{ members: { $elemMatch: { userId, isActive: true } } }
|
||||
]
|
||||
}).map(board => board._id);
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log('dueCards userBoards:', userBoards);
|
||||
console.log('dueCards userBoards count:', userBoards.length);
|
||||
|
||||
// Also check if there are any cards with due dates in the system at all
|
||||
const allCardsWithDueDates = Cards.find({
|
||||
type: 'cardType-card',
|
||||
archived: false,
|
||||
dueAt: { $exists: true, $nin: [null, ''] }
|
||||
}).count();
|
||||
console.log('dueCards: total cards with due dates in system:', allCardsWithDueDates);
|
||||
}
|
||||
|
||||
if (userBoards.length === 0) {
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log('dueCards: No boards found for user, returning ready');
|
||||
}
|
||||
return this.ready();
|
||||
}
|
||||
|
||||
|
|
@ -182,7 +201,23 @@ Meteor.publish('dueCards', function(allUsers = false) {
|
|||
console.log('dueCards options:', JSON.stringify(options, null, 2));
|
||||
}
|
||||
|
||||
return Cards.find(selector, options);
|
||||
const result = Cards.find(selector, options);
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
const count = result.count();
|
||||
console.log('dueCards publication: returning', count, 'cards');
|
||||
if (count > 0) {
|
||||
const sampleCards = result.fetch().slice(0, 3);
|
||||
console.log('dueCards publication: sample cards:', sampleCards.map(c => ({
|
||||
id: c._id,
|
||||
title: c.title,
|
||||
dueAt: c.dueAt,
|
||||
boardId: c.boardId
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
Meteor.publish('globalSearch', function(sessionId, params, text) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue