fix: Use BC resources directly for teammate timesheet view (#189)#190
Draft
akash2017sky wants to merge 1 commit into
Draft
fix: Use BC resources directly for teammate timesheet view (#189)#190akash2017sky wants to merge 1 commit into
akash2017sky wants to merge 1 commit into
Conversation
Teammate selector was fetching BC employees and trying to map each back to a resource via getResourceByEmail, which derives a BC User ID from the email's local-part. That mapping fails whenever the employee record has no email or its prefix doesn't match the resource's timeSheetOwnerUserId convention, leaving the timesheet silently empty. Switch the dropdown to fetch resources (where useTimeSheet=true) and fetch the timesheet directly via resource.number — same pattern the Team page already uses. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #189
Summary
useTimeSheet=true) instead of employees — resources are the entities that own timesheets, so we can fetch them byresource.numberdirectly.getTeammateEntriesno longer relies ongetResourceByEmail, which silently failed whenever an employee's email was missing or its local-part didn't match the resource'stimeSheetOwnerUserIdconvention.TeamList.tsx), so this brings the two views into agreement.Root cause
getTeammateEntriescalledbcClient.getResourceByEmail(teammate.email), which forwards togetResourceForCurrentUser. That helper derives a BC User ID by uppercasing the part before@and filters resources bytimeSheetOwnerUserId. It works for the logged-in user (their UPN follows the convention) but is unreliable for teammates pulled from/employees. When the lookup returnednull, the function returned[]— the empty state seen in the bug report.Test plan
bun run typecheck)useTimeSheet=trueNotes
number(BC code) instead ofjobTitle, sincejobTitleis an employee-only field.getResourceByEmailis still inbcClient.ts(used byTeamList.tsxfor the current user's own resource); not removing it in this PR to keep the change focused.🤖 Generated with Claude Code