mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Log number of rows in user tables in data engine
Summary: Adds a method Table._num_rows using an empty lookup map column. Adds a method Engine.count_rows which adds them all up. Returns the count after applying user actions to be logged by ActiveDoc. Test Plan: Added a unit test in Python. Tested log message manually. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3275
This commit is contained in:
@@ -1172,6 +1172,23 @@ class TestUserActions(test_engine.EngineTestCase):
|
||||
"999",
|
||||
]}]]})
|
||||
|
||||
def test_num_rows(self):
|
||||
self.load_sample(testutil.parse_test_sample({
|
||||
"SCHEMA": [
|
||||
[1, "Address", [
|
||||
[21, "city", "Text", False, "", "", ""],
|
||||
]],
|
||||
],
|
||||
"DATA": {
|
||||
}
|
||||
}))
|
||||
|
||||
table = self.engine.tables["Address"]
|
||||
for i in range(20):
|
||||
self.add_record("Address", None)
|
||||
self.assertEqual(i + 1, table._num_rows())
|
||||
self.assertEqual(i + 1, self.engine.count_rows())
|
||||
|
||||
def test_raw_view_section_restrictions(self):
|
||||
# load_sample handles loading basic metadata, but doesn't create any view sections
|
||||
self.load_sample(self.sample)
|
||||
|
||||
Reference in New Issue
Block a user