From 066447aeabeae8fadca5708939acbd86eaa0cdf8 Mon Sep 17 00:00:00 2001 From: tariqksoliman Date: Wed, 30 Oct 2024 09:08:58 -0700 Subject: [PATCH] Fix: gNUM_geodatasets - ensure no NaN --- API/Backend/Geodatasets/models/geodatasets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/Backend/Geodatasets/models/geodatasets.js b/API/Backend/Geodatasets/models/geodatasets.js index b9b4a9a7..00960922 100644 --- a/API/Backend/Geodatasets/models/geodatasets.js +++ b/API/Backend/Geodatasets/models/geodatasets.js @@ -210,8 +210,8 @@ function makeNewGeodatasetTable( sequelize .query("SELECT MAX(id) FROM geodatasets") .then(([results]) => { - let newTable = - "g" + (parseInt(results[0].max) + 1) + "_geodatasets"; + const max = parseInt(results[0].max); + let newTable = "g" + ((isNaN(max) ? 0 : max) + 1) + "_geodatasets"; Geodatasets.create({ name: name,