Skip to content

Commit

Permalink
Auto repair won't be prompted for when doing a 'count' query (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultmol committed Dec 16, 2023
1 parent 68aac1b commit 196a5ee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,15 @@ class IDE {
}
};
overpass.handlers["onEmptyMap"] = function (empty_msg, data_mode) {
// show warning/info if only invisible data is returned
// get the current query
let query = ide.getRawQuery();

Check warning on line 862 in js/ide.ts

View workflow job for this annotation

GitHub Actions / build

'query' is never reassigned. Use 'const' instead

// check if 'out' followed by any number of characters (non-greedy) and then 'count' is present in the query
var isCountPresent = /out[^;]+?count/.test(query);

Check warning on line 865 in js/ide.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected var, use let or const instead

// show warning/info if only invisible data is returned and 'out...count' is not present in the query
if (empty_msg == "no visible data") {
if (!settings.no_autorepair) {
if (!isCountPresent && !settings.no_autorepair) {
const content = `<p>${i18n.t(
"warning.incomplete.expl.1"
)}</p><p>${i18n.t(
Expand Down Expand Up @@ -894,6 +900,8 @@ class IDE {
content,
dialog_buttons
);
} else if (isCountPresent) {
ide.switchTab("Data");
}
}
// auto tab switching (if only areas are returned)
Expand Down

0 comments on commit 196a5ee

Please sign in to comment.