Simplifying if else

I don’t have any answers for you, but I do have some observations:

Why is insertValues() defined with the async keyword? It doesn’t have any statements with await .
You don’t need to call insertValues() with an await since it doesn’t return a Promise .
Furthermore, you call wixData.aggregate(“projectproducts”) , insertValues(), and specificationValue() with both an await and .then() . This is incorrect and could result in unpredictable results. The call to an asynchronous function/service should use either an await or a .then() — but not both .