Amaresh - Fix: Add Lost Time for project/team returns 404 due to missing personId lookup#2276
Open
amaresh2001 wants to merge 2 commits into
Open
Amaresh - Fix: Add Lost Time for project/team returns 404 due to missing personId lookup#2276amaresh2001 wants to merge 2 commits into
amaresh2001 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
POST /api/TimeEntrywas returning a 404 ("User not found") for any lost-time entry of typeprojectorteam, so those entries silently failed to save even after the frontend fix in PR #4738 stopped the UI from erroring visibly. Root cause:postTimeEntryControllerunconditionally didUserProfile.findById(timeEntry.personId)and 404'd if no user was found, butprojectandteamtype lost-time entries never have apersonId(only aprojectIdorteamId), so the lookup always failed for those two types.Related PRS (if any):
This backend PR is related to the #4738 frontend PR.
To test this backend PR you need to checkout the #4738 frontend PR (branch
shravya/bugfix/3824).Main changes explained:
src/controllers/timeEntryController.jsfor making theUserProfilelookup/update inpostTimeEntryconditional onentryTypebeingpersonordefault(the only types that carry apersonId). Forproject/teamentries, the user-profile lookup, the 404 guard, the deactivation check, the tangible/intangible hour updates, and theisFirstTimelogupdate are all skipped, and the time entry is saved directly. No behavior change forperson/defaultentries.src/controllers/timeEntryController.jsfor clearing theLostTeamEntry_*cache inpostTimeEntrywhen a new team entry is added. ' editTimeEntryanddeleteTimeEntryalready did this, butpostTimeEntry(create) didn't, so newly-added team lost time sat behind a stale cached response for up to 5 minutes (the cache'sstdTTL`) before showing up under "Show Team Lost Time".How to test:
amaresh/fix-lost-time-post-entry-404) and runnpm installandnpm run devto run this PR locallyshravya/bugfix/3824) and run it locally, pointed at this backendScreenshots or videos of changes:
Note: