Skip to content

Commit

Permalink
fix: info and search button with empty second empty query input
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickskowronekdkfz committed Oct 28, 2024
1 parent f66d47e commit 7357aef
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 7357aef

Please sign in to comment.