Fix to accommodate filtering updates for GoogleSheets
This commit is contained in:
parent
0f8df77ded
commit
ee968b212a
|
@ -566,24 +566,20 @@ class GoogleSheetsIntegration implements DatasourcePlus {
|
||||||
query.filters.equal[`_${GOOGLE_SHEETS_PRIMARY_KEY}`] = id
|
query.filters.equal[`_${GOOGLE_SHEETS_PRIMARY_KEY}`] = id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let filtered = dataFilters.runQuery(
|
|
||||||
rows,
|
|
||||||
query.filters || {},
|
|
||||||
(row: GoogleSpreadsheetRow, headerKey: string) => {
|
|
||||||
return row.get(headerKey)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
if (hasFilters && query.paginate) {
|
if (hasFilters && query.paginate) {
|
||||||
filtered = filtered.slice(offset, offset + limit)
|
rows = rows.slice(offset, offset + limit)
|
||||||
}
|
}
|
||||||
const headerValues = sheet.headerValues
|
const headerValues = sheet.headerValues
|
||||||
let response = []
|
let response = []
|
||||||
for (let row of filtered) {
|
for (let row of rows) {
|
||||||
response.push(
|
response.push(
|
||||||
this.buildRowObject(headerValues, row.toObject(), row._rowNumber)
|
this.buildRowObject(headerValues, row.toObject(), row.rowNumber)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response = dataFilters.runQuery(response, query.filters || {})
|
||||||
|
|
||||||
if (query.sort) {
|
if (query.sort) {
|
||||||
if (Object.keys(query.sort).length !== 1) {
|
if (Object.keys(query.sort).length !== 1) {
|
||||||
console.warn("Googlesheets does not support multiple sorting", {
|
console.warn("Googlesheets does not support multiple sorting", {
|
||||||
|
|
Loading…
Reference in New Issue