UBERF-8851: Fix isDone is wrong (#7456)

This commit is contained in:
Andrey Sobolev 2024-12-13 21:09:52 +07:00 committed by GitHub
parent 5832ac119a
commit 5175381f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -572,6 +572,37 @@ export const taskOperation: MigrateOperation = {
{ {
state: 'migrateRanks', state: 'migrateRanks',
func: migrateRanks func: migrateRanks
},
{
state: 'migrate_wrong_isdone',
func: async (client: MigrationClient) => {
const statuses = client.model.findAllSync(core.class.Status, {
category: { $in: [task.statusCategory.Won, task.statusCategory.Lost] }
})
await client.update<Task>(
DOMAIN_TASK,
{
_class: { $in: client.hierarchy.getDescendants(task.class.Task) },
status: { $in: statuses.map((it) => it._id) },
isDone: false
},
{
isDone: true
}
)
await client.update<Task>(
DOMAIN_TASK,
{
_class: { $in: client.hierarchy.getDescendants(task.class.Task) },
status: { $nin: statuses.map((it) => it._id) },
isDone: true
},
{
isDone: false
}
)
}
} }
]) ])
}, },