mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Restoring separated transform columns
Summary: Fix for a bug that prevented two users to change column types at the same time. Test Plan: Added and updated Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3745
This commit is contained in:
@@ -504,14 +504,6 @@ def N(value):
|
||||
return 0
|
||||
|
||||
|
||||
def CURRENT_CONVERSION(rec):
|
||||
"""
|
||||
Internal function used by Grist during column type conversions. Not available for use in
|
||||
formulas.
|
||||
"""
|
||||
return rec.gristHelper_Converted
|
||||
|
||||
|
||||
def NA():
|
||||
"""
|
||||
Returns the "value not available" error, `#N/A`.
|
||||
|
||||
@@ -357,7 +357,7 @@ class TestTriggerFormulas(test_engine.EngineTestCase):
|
||||
])
|
||||
|
||||
# ModifyColumn doesn't trigger recalcs.
|
||||
out_actions = self.apply_user_action(["ModifyColumn", "Creatures", "Size", {type: 'Numeric'}])
|
||||
out_actions = self.apply_user_action(["ModifyColumn", "Creatures", "Size", {"type": 'Numeric'}])
|
||||
self.assertEqual(out_actions.calls, {})
|
||||
|
||||
|
||||
|
||||
@@ -40,10 +40,8 @@ _action_types = {}
|
||||
# requested.
|
||||
DIRECT_ACTION = 0
|
||||
|
||||
# Fields of _grist_Tables_column table that may be modified using ModifyColumns useraction.
|
||||
_modifiable_col_fields = {'type', 'widgetOptions', 'formula', 'isFormula', 'label',
|
||||
'untieColIdFromLabel'}
|
||||
|
||||
# Fields of _grist_Tables_column table that can't be modified using ModifyColumn useraction.
|
||||
_unmodifiable_col_fields = {'colId', 'id', 'parentId'}
|
||||
# Fields of _grist_Tables_column table that are inherited by group-by columns from their source.
|
||||
_inherited_groupby_col_fields = {'colId', 'widgetOptions', 'label', 'untieColIdFromLabel'}
|
||||
|
||||
@@ -1302,11 +1300,6 @@ class UserActions(object):
|
||||
))
|
||||
)
|
||||
|
||||
if transform:
|
||||
# Delete any currently existing transform columns with the same id
|
||||
if self._engine.tables[table_id].has_column(col_id):
|
||||
self.RemoveColumn(table_id, col_id)
|
||||
|
||||
ret = self.doAddColumn(table_id, col_id, col_info)
|
||||
|
||||
if not transform and table_rec.rawViewSectionRef:
|
||||
@@ -1469,7 +1462,7 @@ class UserActions(object):
|
||||
# metadata record. We implement the former interface by forwarding to the latter.
|
||||
col = self._docmodel.get_column_rec(table_id, col_id)
|
||||
|
||||
update_values = {k: v for k, v in six.iteritems(col_info) if k in _modifiable_col_fields}
|
||||
update_values = {k: v for k, v in six.iteritems(col_info) if k not in _unmodifiable_col_fields}
|
||||
if '_position' in col_info:
|
||||
update_values['parentPos'] = col_info['_position']
|
||||
self._docmodel.update([col], **update_values)
|
||||
|
||||
Reference in New Issue
Block a user