Skip to content

Commit

Permalink
Fix background transpiler check for latest command dict/mission model
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythicaeda committed Mar 18, 2024
1 parent 3d4cf13 commit 249266d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions sequencing-server/src/backgroundTranspiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ 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...',
);
return;
}

// 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) {
Expand Down

0 comments on commit 249266d

Please sign in to comment.