IO-1693 Allow 0 line supplements.
This commit is contained in:
@@ -37,7 +37,6 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
||||
});
|
||||
|
||||
//Wahtever is left in the existing lines, are lines that should be removed.
|
||||
|
||||
const insertQueries = linesToInsert.reduce((acc, value, idx) => {
|
||||
return acc + generateInsertQuery(value, idx, jobId);
|
||||
}, "");
|
||||
@@ -49,6 +48,13 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
||||
const removeQueries = existingLines.reduce((acc, value, idx) => {
|
||||
return acc + generateRemoveQuery(value, idx);
|
||||
}, "");
|
||||
console.log(insertQueries, updateQueries, removeQueries);
|
||||
|
||||
if ((insertQueries + updateQueries + removeQueries).trim() === "") {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(null);
|
||||
});
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(gql`
|
||||
|
||||
@@ -220,12 +220,13 @@ export function JobsAvailableContainer({
|
||||
);
|
||||
|
||||
delete supp.joblines;
|
||||
await client.mutate({
|
||||
mutation: gql`
|
||||
${suppDelta}
|
||||
`,
|
||||
});
|
||||
|
||||
if (suppDelta !== null) {
|
||||
await client.mutate({
|
||||
mutation: gql`
|
||||
${suppDelta}
|
||||
`,
|
||||
});
|
||||
}
|
||||
const updateResult = await updateJob({
|
||||
variables: {
|
||||
jobId: selectedJob,
|
||||
|
||||
Reference in New Issue
Block a user