Skip to content

Commit 82f16af

Browse files
committed
Merge branch 'fix/extract-with-filters' into 'master'
Fix extract CSV file with filters applied. See merge request datopian/clients/nhs-dataexplorer!21
2 parents 10b5508 + 6275662 commit 82f16af

File tree

1 file changed

+10
-14
lines changed
  • ckanext/dataexplorer/public/vendor/recline

1 file changed

+10
-14
lines changed

ckanext/dataexplorer/public/vendor/recline/recline.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4970,7 +4970,7 @@ this.recline.View = this.recline.View || {};
49704970
for (const [key, value] of Object.entries(filters)) {
49714971
let single_where_statament = "";
49724972
value.forEach((value_item) => {
4973-
if (this.get_field_type(fields, key) == "num") {
4973+
if (this.get_field_type(value_item) == "num") {
49744974
single_where_statament += `${key} = ${value_item} OR `;
49754975
} else {
49764976
single_where_statament += `${key} = "${value_item}" OR `;
@@ -4985,7 +4985,7 @@ this.recline.View = this.recline.View || {};
49854985
if (q != "") {
49864986
let where_q = "";
49874987
for (const [key, value] of Object.entries(filters)) {
4988-
if (this.get_field_type(fields, key) == "string") {
4988+
if (this.get_field_type(value) == "string") {
49894989
where_q_str += ` LOWER(${key}) like LOWER("${value.slice(
49904990
0,
49914991
-2
@@ -5002,20 +5002,16 @@ this.recline.View = this.recline.View || {};
50025002
}
50035003
return where_str;
50045004
},
5005-
get_field_type: function (fields, key) {
5006-
let string_types = ["STRING"];
5007-
let field_type = [];
5008-
fields.forEach((lfield) => {
5009-
if (lfield["id"] === key) {
5010-
field_type = lfield["type"];
5011-
}
5012-
});
5013-
5014-
if (field_type[0] in string_types) {
5005+
get_field_type: function (value) {
5006+
5007+
if (typeof value == "string"){
50155008
return "string";
5016-
} else {
5017-
return "num";
50185009
}
5010+
5011+
if (typeof value == "number"){
5012+
return "num"
5013+
}
5014+
50195015
},
50205016
});
50215017
})(jQuery, recline.View);

0 commit comments

Comments
 (0)