mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
f024aaaf5d
Summary: Addresses several issues: - Error 'Cannot modify summary group-by column' when changing Text -> ChoiceList in the presence of summary tables. - Error 'ModifyColumn in unexpected position' when changing ChoiceList -> Text in the presence of summary tables. - Double-evaluation of trigger formulas in some cases. Fixes include: - Fixed verification that summary group-by columns match the underlying ones, and added comments to explain. - Avoid updating non-metadata lookups after each doc-action (early lookups generated extra actions to populate summary tables, causing the 'ModifyColumn in unexpected position' bug) - When updating formulas, do update lookups first. - Made a client-side tweak to avoid a JS error in case of some undos. Solution to reduce lookups is based on https://phab.getgrist.com/D3069?vs=on&id=12445, and tests for double-evaluation of trigger formulas are taken from there. Add a new test case to protect against bugs caused by incorrect order of evaluating #lookup columns. Enhanced ChoiceList browser test to check a conversion scenario in the presence of summary tables, previously triggering bugs. Test Plan: Various tests added or enhanced. Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3184
56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""
|
|
Some more test cases for summary tables, involving UNDO.
|
|
"""
|
|
import logger
|
|
import testutil
|
|
import test_engine
|
|
|
|
log = logger.Logger(__name__, logger.INFO)
|
|
|
|
class TestSummaryUndo(test_engine.EngineTestCase):
|
|
sample = testutil.parse_test_sample({
|
|
"SCHEMA": [
|
|
[1, "Person", [
|
|
[1, "state", "Text", False],
|
|
]]
|
|
],
|
|
"DATA": {
|
|
"Person": [
|
|
["id", "state", ],
|
|
[ 1, "NY", ],
|
|
[ 2, "IL", ],
|
|
[ 3, "ME", ],
|
|
[ 4, "NY", ],
|
|
[ 5, "IL", ],
|
|
]
|
|
}
|
|
})
|
|
|
|
def test_summary_undo1(self):
|
|
# This tests a particular case of a bug when a summary table wasn't fully updated after UNDO.
|
|
self.load_sample(self.sample)
|
|
# Create a summary section, grouped by the "State" column.
|
|
self.apply_user_action(["CreateViewSection", 1, 0, "record", [1]])
|
|
self.assertTableData('GristSummary_6_Person', cols="subset", data=[
|
|
[ "id", "state", "count"],
|
|
[ 1, "NY", 2],
|
|
[ 2, "IL", 2],
|
|
[ 3, "ME", 1],
|
|
])
|
|
|
|
out_actions = self.update_record('Person', 4, state='ME')
|
|
self.assertTableData('GristSummary_6_Person', cols="subset", data=[
|
|
[ "id", "state", "count"],
|
|
[ 1, "NY", 1],
|
|
[ 2, "IL", 2],
|
|
[ 3, "ME", 2],
|
|
])
|
|
|
|
self.apply_undo_actions(out_actions.undo[0:1])
|
|
self.assertTableData('GristSummary_6_Person', cols="subset", data=[
|
|
[ "id", "state", "count"],
|
|
[ 1, "NY", 2],
|
|
[ 2, "IL", 2],
|
|
[ 3, "ME", 1],
|
|
])
|