diff --git a/Dockerfile b/Dockerfile index 101f7a99..665a7e44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ FROM node:14-buster as builder # Install all node dependencies. WORKDIR /grist COPY package.json yarn.lock /grist/ -RUN yarn install --frozen-lockfile --verbose +RUN yarn install --frozen-lockfile --verbose --network-timeout 600000 # Install any extra node dependencies (at root level, to avoid having to wrestle # with merging them). @@ -23,7 +23,7 @@ COPY --from=ext / /grist/ext RUN \ mkdir /node_modules && \ cd /grist/ext && \ - { if [ -e package.json ] ; then yarn install --frozen-lockfile --modules-folder=/node_modules --verbose ; fi } + { if [ -e package.json ] ; then yarn install --frozen-lockfile --modules-folder=/node_modules --verbose --network-timeout 600000 ; fi } # Build node code. COPY tsconfig.json /grist diff --git a/sandbox/grist/imports/fixtures/test_falsy_cells.xlsx b/sandbox/grist/imports/fixtures/test_falsy_cells.xlsx new file mode 100644 index 00000000..d4efdf50 Binary files /dev/null and b/sandbox/grist/imports/fixtures/test_falsy_cells.xlsx differ diff --git a/sandbox/grist/imports/import_xls_test.py b/sandbox/grist/imports/import_xls_test.py index a905ef9a..935c7104 100644 --- a/sandbox/grist/imports/import_xls_test.py +++ b/sandbox/grist/imports/import_xls_test.py @@ -189,5 +189,22 @@ class TestImportXLS(unittest.TestCase): ], }]) + def test_falsy_cells(self): + # Falsy cells should be parsed as Numeric, not Date. + parsed_file = import_xls.parse_file(*_get_fixture('test_falsy_cells.xlsx')) + tables = parsed_file[1] + self.assertEqual(tables, [{ + 'table_name': 'Sheet1', + 'column_metadata': [ + {'id': u'A', 'type': 'Numeric'}, + {'id': u'B', 'type': 'Numeric'}, + ], + 'table_data': [ + [0, 0], + [0, 0], + ], + }]) + + if __name__ == '__main__': unittest.main() diff --git a/sandbox/grist/parse_data.py b/sandbox/grist/parse_data.py index 47f95d04..20ed9ea2 100644 --- a/sandbox/grist/parse_data.py +++ b/sandbox/grist/parse_data.py @@ -83,7 +83,7 @@ class SimpleDateTimeConverter(BaseConverter): def convert(cls, value): if type(value) is datetime.datetime: return value - elif not value: + elif value is None: return None raise ValueError() diff --git a/test/common/parseDate.ts b/test/common/parseDate.ts index ec44977e..ad5c8fde 100644 --- a/test/common/parseDate.ts +++ b/test/common/parseDate.ts @@ -331,6 +331,7 @@ describe('parseDate', function() { }); it('should handle datetimes as formatted by moment', function() { + this.timeout(10000); // there may be a LOT of timezone names. for (const date of ['2020-02-03', '2020-06-07', '2020-10-11']) { // different months for daylight savings const dateTime = date + ' 12:34:56'; const utcMoment = moment.tz(dateTime, 'UTC');