Skip to content

Commit

Permalink
Merge branch 'main' into rlim/reusable-deploy-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rzlim08 authored Mar 20, 2024
2 parents 5856ab4 + 6e341d0 commit c16043b
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,22 +829,8 @@ export const resolvers: Resolvers = {
// NEXT GEN:
const nextGenEnabled = await shouldReadFromNextGen(context);
if (nextGenEnabled) {
console.log("bchu: " + queryingIdsOnly);
if (queryingIdsOnly) {
console.log(
"bchu: " + convertSequencingReadsQuery(context.params.query),
);
console.log(
"bchu: " +
JSON.stringify({
where: {
collectionId: input.where?.collectionId,
taxon: input.where?.taxon,
consensusGenomes: input.where?.consensusGenomes,
},
}),
);
const nextGenResponse = await fetchFromNextGen({
const nextGenPromise = fetchFromNextGen({
customQuery: convertSequencingReadsQuery(context.params.query),
customVariables: {
// Entities Service doesn't support sample metadata yet.
Expand All @@ -858,9 +844,7 @@ export const resolvers: Resolvers = {
args,
context,
});
console.log("bchu: " + JSON.stringify(nextGenResponse));
let sequencingReads = nextGenResponse.data.sequencingReads;
if (input.where?.sample != null && sequencingReads.length > 0) {
if (input.where?.sample != null) {
const filteredSampleIds = new Set(
(
await getFromRails({
Expand All @@ -879,13 +863,13 @@ export const resolvers: Resolvers = {
})
).all_samples_ids,
);
console.log("bchu: " + JSON.stringify(filteredSampleIds));
sequencingReads = sequencingReads.filter(sequencingRead =>
filteredSampleIds.has(sequencingRead.sample.railsSampleId),
return (await nextGenPromise).data.sequencingReads.filter(
sequencingRead =>
filteredSampleIds.has(sequencingRead.sample.railsSampleId),
);
} else {
return (await nextGenPromise).data.sequencingReads;
}
console.log("bchu: " + JSON.stringify(sequencingReads));
return sequencingReads;
}

const nextGenResponse = await fetchFromNextGen({
Expand Down

0 comments on commit c16043b

Please sign in to comment.