mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add a row to summary tables grouped by list column(s) corresponding to empty lists
Summary: Adds some special handling to summary table and lookup logic: - Source rows with empty choicelists/reflists get a corresponding summary row with an empty string/reference when grouping by that column, instead of excluding them from any group - Adds a new `QueryOperation` 'empty' in the client which is used in `LinkingState`, `QuerySet`, and `recursiveMoveToCursorPos` to match empty lists in source tables against falsy values in linked summary tables. - Adds a new parameter `match_empty` to the Python `CONTAINS` function so that regular formulas can implement the same behaviour as summary tables. See https://grist.slack.com/archives/C0234CPPXPA/p1654030490932119 - Uses the new `match_empty` argument in the formula generated for the `group` column when detaching a summary table. Test Plan: Updated and extended Python and nbrowser tests of summary tables grouped by choicelists to test for new behaviour with empty lists. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3471
This commit is contained in:
@@ -9,10 +9,10 @@ import itertools
|
||||
|
||||
import six
|
||||
|
||||
import functions
|
||||
import records
|
||||
import usertypes
|
||||
import relabeling
|
||||
import lookup
|
||||
import table
|
||||
import moment
|
||||
from schema import RecalcWhen
|
||||
@@ -31,7 +31,7 @@ def _record_ref_list_set(table_id, group_by, sort_by=None):
|
||||
@usertypes.formulaType(usertypes.ReferenceList(table_id))
|
||||
def func(rec, table):
|
||||
lookup_table = table.docmodel.get_table(table_id)
|
||||
return lookup_table.lookupRecords(sort_by=sort_by, **{group_by: lookup._Contains(rec.id)})
|
||||
return lookup_table.lookupRecords(sort_by=sort_by, **{group_by: functions.CONTAINS(rec.id)})
|
||||
return func
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user