Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display employee photos in cards #478

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

Enochen
Copy link
Contributor

@Enochen Enochen commented Oct 31, 2023

Summary

This allows photos to be visible. The issue was that admin accounts supported photos but no admin account in the db actually has a photo. However the corresponding driver accounts do have photos.

This PR "combines" the two employee account objects so that you only need a photoLink in either your admin or driver account for it to display in your card.

Note that this will use the driver photoLink if both are provided. In the future we should aim to restructure the DB so that this kind of ambiguity isn't possible.

Test Plan

image

Notes

Note that this will use the driver photoLink if both are provided. In the future we should aim to restructure the DB so that this kind of ambiguity isn't possible.

@Enochen Enochen requested a review from a team as a code owner October 31, 2023 23:24
@dti-github-bot
Copy link
Member

[diff-counting] Significant lines: 17.

Copy link
Contributor

@CollinWoo CollinWoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Enoch! The employee photos now show up perfectly on my end. This seems like a good fix for now, but I definitely agree that more consideration should be taken with overriding fields between the Admin and Driver classes

return true;
const employees: Record<string, DriverType | AdminType> = {};
[...admins, ...drivers].forEach((employee) => {
employees[employee.id] = { ...employees[employee.id], ...employee };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one potential concern with this array destructuring is that fields other than photolink could be overridden as well if they differ between the driver and the admin. I'm not sure how often this would occur though.

@Enochen Enochen merged commit 136b1ce into master Nov 21, 2023
6 checks passed
@Enochen Enochen deleted the enoch/employee-cards-imgs branch November 21, 2023 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants