Skip to content

Commit

Permalink
fix: Fix more run page diff logs (#1414)
Browse files Browse the repository at this point in the history
Don't need to query `id` from `methodLinks`.
  • Loading branch information
bchu1 authored Dec 19, 2024
1 parent 36ba07f commit 78b8fa9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
30 changes: 24 additions & 6 deletions frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Tomogram_Reconstruction_Method_Enum,
} from 'app/__generated_v2__/graphql'

/* eslint-disable no-console, no-param-reassign */
/* eslint-disable no-console, no-param-reassign, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return */
export function logIfHasDiff(
url: string,
v1: GetRunByIdQuery,
Expand All @@ -29,8 +29,14 @@ export function logIfHasDiff(
delete annotationFile.node.alignmentId
}
// Sort annotation files for consistency.
annotationShape.annotationFiles.edges.sort((edge) =>
edge.node.format.localeCompare(edge.node.format),
annotationShape.annotationFiles.edges.sort(
(annotationFileA, annotationFileB) =>
annotationFileA.node.format.localeCompare(annotationFileB.node.format),
)
// Sort method links for consistency.
annotationShape.annotation?.methodLinks.edges.sort(
(methodLinkA, methodLinkB) =>
methodLinkA.node.link.localeCompare(methodLinkB.node.link),
)
}
for (const tomogram of v2.tomograms) {
Expand Down Expand Up @@ -190,6 +196,7 @@ export function logIfHasDiff(
shapeType: file.shape_type as Annotation_File_Shape_Type_Enum,
annotationFiles: {
edges: file.annotation.files
.filter((nestedFile) => nestedFile.shape_type === file.shape_type)
.map((nestedFile) => ({
node: {
format: nestedFile.format,
Expand All @@ -212,7 +219,18 @@ export function logIfHasDiff(
isCuratorRecommended: file.annotation.is_curator_recommended,
lastModifiedDate: `${file.annotation.last_modified_date}T00:00:00+00:00`,
methodLinks: {
edges: [],
edges: file.annotation.method_links
?.map((methodLink: any) => ({
node: {
link: methodLink.link,
linkType: methodLink.link_type,
name: methodLink.custom_name,
},
}))
.sort(
(methodLinkA: any, methodLinkB: any) =>
methodLinkA.node.link?.localeCompare(methodLinkB.node.link),
),
},
methodType: file.annotation.method_type as Annotation_Method_Type_Enum,
objectCount: file.annotation.object_count,
Expand Down Expand Up @@ -295,9 +313,9 @@ export function logIfHasDiff(

if (Object.keys(diffObject).length > 0) {
console.log(
`DIFF AT ${url} ========== ${JSON.stringify(
`DIFF AT ${url} ======================================== ${JSON.stringify(
v1Transformed,
)} ========== ${JSON.stringify(v2)}`,
)} ======================================== ${JSON.stringify(v2)}`,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(`
methodLinks {
edges {
node {
id
link
linkType
name
Expand Down

0 comments on commit 78b8fa9

Please sign in to comment.