mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Linking summary tables grouped by list columns
Summary:
Prefix keys of `LinkingState.filterColValues` with `_contains:` when the source column is a ChoiceList or ReferenceList.
This is parsed out to make a boolean `isContainsFilter` which is kept in each value of `QueryRefs.filterTuples` (previously `filterPairs`).
Then when converting back in `convertQueryFromRefs` we construct `Query.contains: {[colId: string]: boolean}`.
Finally `getFilterFunc` uses `Query.contains` to decide what kind of filtering to do.
This is not pretty, but the existing code is already very complex and it was hard to find something that wouldn't require touching loads of code just to make things compile.
Test Plan: Added a new nbrowser test and fixture, tests that selecting a source table by summary tables grouped by a choicelist column, non-list column, and both all filter the correct data.
Reviewers: dsagal
Reviewed By: dsagal
Differential Revision: https://phab.getgrist.com/D2940
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Query} from 'app/common/ActiveDocAPI';
|
||||
import {ServerQuery} from 'app/common/ActiveDocAPI';
|
||||
import {ApiError} from 'app/common/ApiError';
|
||||
import {DocData} from 'app/common/DocData';
|
||||
import {parseFormula} from 'app/common/Formula';
|
||||
@@ -10,7 +10,7 @@ import {quoteIdent} from 'app/server/lib/SQLiteDB';
|
||||
* formulas. Use of this representation should be limited to within a
|
||||
* trusted part of Grist since it assembles SQL strings.
|
||||
*/
|
||||
export interface ExpandedQuery extends Query {
|
||||
export interface ExpandedQuery extends ServerQuery {
|
||||
// Errors detected for given columns because of formula issues. We
|
||||
// need to make sure the result of the query contains these error
|
||||
// objects. It is awkward to write a sql selection that constructs
|
||||
@@ -38,7 +38,7 @@ export interface ExpandedQuery extends Query {
|
||||
*
|
||||
* If onDemandFormulas is set, ignore stored formula columns, and compute them using SQL.
|
||||
*/
|
||||
export function expandQuery(iquery: Query, docData: DocData, onDemandFormulas: boolean = true): ExpandedQuery {
|
||||
export function expandQuery(iquery: ServerQuery, docData: DocData, onDemandFormulas: boolean = true): ExpandedQuery {
|
||||
const query: ExpandedQuery = {
|
||||
tableId: iquery.tableId,
|
||||
filters: iquery.filters,
|
||||
|
||||
Reference in New Issue
Block a user