From 249266d6838827863dc3b2ce1747251f728ba1e7 Mon Sep 17 00:00:00 2001 From: Theresa Kamerman Date: Fri, 15 Mar 2024 17:19:08 -0700 Subject: [PATCH 1/2] Fix background transpiler check for latest command dict/mission model --- sequencing-server/src/backgroundTranspiler.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sequencing-server/src/backgroundTranspiler.ts b/sequencing-server/src/backgroundTranspiler.ts index f78863f882..a049335bac 100644 --- a/sequencing-server/src/backgroundTranspiler.ts +++ b/sequencing-server/src/backgroundTranspiler.ts @@ -15,8 +15,8 @@ export async function backgroundTranspiler(numberOfThreads: number = 2) { } // Fetch latest mission model - const { mission_model_aggregate } = await getLatestMissionModel(graphqlClient); - if (!mission_model_aggregate) { + const { mission_model_aggregate: {aggregate: {max: {id: missionModelId} } } } = await getLatestMissionModel(graphqlClient); + if (!missionModelId) { console.log( '[ Background Transpiler ] Unable to fetch the latest mission model. Aborting background transpiling...', ); @@ -24,16 +24,14 @@ export async function backgroundTranspiler(numberOfThreads: number = 2) { } // Fetch latest command dictionary - const { command_dictionary_aggregate } = await getLatestCommandDictionary(graphqlClient); - if (!command_dictionary_aggregate) { + const { command_dictionary_aggregate: {aggregate: {max: {id: commandDictionaryId} } } } = await getLatestCommandDictionary(graphqlClient); + if (!commandDictionaryId) { console.log( '[ Background Transpiler ] Unable to fetch the latest command dictionary. Aborting background transpiling...', ); return; } - const commandDictionaryId = command_dictionary_aggregate.aggregate.max.id; - const missionModelId = mission_model_aggregate.aggregate.max.id; const { expansion_rule } = await getExpansionRule(graphqlClient, missionModelId, commandDictionaryId); if (expansion_rule === null || expansion_rule.length === 0) { From 98cd5036e0703ba435654fe2467ec9c56628b763 Mon Sep 17 00:00:00 2001 From: Ryan Goetz Date: Mon, 18 Mar 2024 05:46:00 -1000 Subject: [PATCH 2/2] Tine Bug fix that I noticed. I noticed this while I was testing the query refactor branch. I accidentally swapped 'missionID' and 'CommandID' in the Hasura call. --- sequencing-server/src/backgroundTranspiler.ts | 2 +- sequencing-server/src/utils/hasura.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sequencing-server/src/backgroundTranspiler.ts b/sequencing-server/src/backgroundTranspiler.ts index a049335bac..14b6b426f5 100644 --- a/sequencing-server/src/backgroundTranspiler.ts +++ b/sequencing-server/src/backgroundTranspiler.ts @@ -49,7 +49,7 @@ export async function backgroundTranspiler(numberOfThreads: number = 2) { }); const commandTypes = await commandTypescriptDataLoader.load({ - dictionaryId: missionModelId, + dictionaryId: commandDictionaryId, }); if (commandTypes === null) { diff --git a/sequencing-server/src/utils/hasura.ts b/sequencing-server/src/utils/hasura.ts index 29beeb6f58..e6b64c6c01 100644 --- a/sequencing-server/src/utils/hasura.ts +++ b/sequencing-server/src/utils/hasura.ts @@ -453,7 +453,7 @@ export async function getExpansionRule( }>( gql` query GetExpansonLogic { - expansion_rule(where: {authoring_command_dict_id: {_eq: ${missionModelId}}, authoring_mission_model_id: {_eq: ${commandDictionaryId} }}) { + expansion_rule(where: {authoring_command_dict_id: {_eq: ${commandDictionaryId}}, authoring_mission_model_id: {_eq: ${missionModelId} }}) { id activity_type expansion_logic