Closed jenshp closed 6 years ago
Wow that code is old... I don't remember the reason for the filter on statusTypeId=WorkEffort and the check for starting with 'We', seems like it had something to do with custom status flows for projects but I don't remember and it probably doesn't matter. These changes look fine.
This updates pull request #32 regarding the doubt you had on the condition "!statusItem.statusId?.startsWith('We')".
First of all, the condition should have been "!statusItem.statusTypeId == 'WorkEffort'", which is also more robust. Second, the condition is already present in the entity-find-one that sets the variable statusItem in the first place, but as statusTypeId is not a PK field, it was being ignored in the entity-find-one and results of types other than WorkEffort were being seen. In the end, the cleaner and more robust solution is to do one single DB query that under normal circumstances will always return the single statusItem needed.