Skip to content

Commit

Permalink
Merge pull request #140 from samply/fix/QueryButtonMLines
Browse files Browse the repository at this point in the history
fix: info and search button with empty second empty query input
  • Loading branch information
patrickskowronekdkfz authored Oct 28, 2024
2 parents f66d47e + 7357aef commit 3b92d17
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
const ast = buildAstFromQuery($queryStore);
if (ast.children.includes(null)) {
alert(
"No query entered in one of the queries. You can enter a query or remove the query fields.",
);
return;
}
options?.spots?.forEach((spot: SpotOption) => {
const name = spot.name;
const measureItem: MeasureOption | undefined = $measureStore.find(
Expand Down
40 changes: 21 additions & 19 deletions packages/lib/src/stores/negotiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,30 @@ export const buildHumanReadableRecursively = (
}

queryLayer.children.forEach((child: AstElement, index: number): void => {
if ("type" in child && "value" in child && "key" in child) {
if (typeof child.value === "string") {
humanReadableQuery += `(${child.key} ${child.type} ${child.value})`;
if (child !== null) {
if ("type" in child && "value" in child && "key" in child) {
if (typeof child.value === "string") {
humanReadableQuery += `(${child.key} ${child.type} ${child.value})`;
}
if (
typeof child.value === "object" &&
"min" in child.value &&
"max" in child.value
) {
humanReadableQuery += `(${child.key} ${child.type} ${child.value.min} and ${child.value.max})`;
}
}
if (
typeof child.value === "object" &&
"min" in child.value &&
"max" in child.value
) {
humanReadableQuery += `(${child.key} ${child.type} ${child.value.min} and ${child.value.max})`;
}
}

humanReadableQuery = buildHumanReadableRecursively(
child,
humanReadableQuery,
);
humanReadableQuery = buildHumanReadableRecursively(
child,
humanReadableQuery,
);

if (index === queryLayer.children.length - 1) {
}
if (index < queryLayer.children.length - 1) {
humanReadableQuery += ` ${queryLayer.operand} `;
if (index === queryLayer.children.length - 1) {
}
if (index < queryLayer.children.length - 1) {
humanReadableQuery += ` ${queryLayer.operand} `;
}
}
});

Expand Down

0 comments on commit 3b92d17

Please sign in to comment.