-
Notifications
You must be signed in to change notification settings - Fork 230
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
MNTOR-3893 - Fix qa custom broker tool #5647
base: main
Are you sure you want to change the base?
Conversation
Preview URL 🚀 : https://blurts-server-pr-5647-mgjlpikfea-uk.a.run.app |
3c23412
to
9015002
Compare
@@ -106,11 +107,21 @@ export default async function DashboardPage(props: Props) { | |||
return redirect("/user/welcome"); | |||
} | |||
|
|||
const latestScan = await getScanResultsWithBroker( | |||
const enabledFeatureFlags = await getEnabledFeatureFlags({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should wrap the logic here with an if
check (safer):
if (not prod && feature flag enabled for this email) {
scanResults = getMock()
} else {
scanResults = getReal()
}
This way we 1) only go to the db once 2) logic seems clearer to read
@@ -491,6 +489,45 @@ async function getScanResultsWithBroker( | |||
return { scan: scan ?? null, results: scanResults } as LatestOnerepScanData; | |||
} | |||
|
|||
async function getMockedScanResults( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the naming better with getMockedScanResults
with getMockedScanResultsWithBrokers
? This returns the aggregated results I believe
src/db/tables/qa_customs.ts
Outdated
const res = (await knex("qa_custom_brokers") | ||
.where("onerep_profile_id", onerep_profile_id) | ||
.select("*")) as QaBrokerData[]; | ||
async function getAllQaCustomBrokers(): Promise< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename this to something like scanResultWithBrokers
.. also for the UI, it might be confusing to see the word "brokers" and see scan results
attributes
c7cb116
to
000bb67
Compare
@@ -47,24 +47,13 @@ function duplicateObj(obj: mockInputs, n: string | undefined) { | |||
return Array.from({ length: howMany }, () => obj); | |||
} | |||
|
|||
export async function GET(req: NextRequest) { | |||
export async function GET() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the need for profileId
here since it's not being used.
const scanResults = useMockedScans | ||
? await getMockedScanResults(profileId) | ||
: await getScanResultsWithBroker(profileId, hasPremium(session.user)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should only load one db at a time.
a402479
to
6de72c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
References:
Jira: MNTOR-3893
Figma:
Description
Screenshot (if applicable)
Not applicable.
How to test
Checklist (Definition of Done)