From e4121ad966acaa07c3331724e759a9b485d22a6a Mon Sep 17 00:00:00 2001 From: Ahmed Date: Thu, 14 Jan 2021 01:00:44 +0530 Subject: [PATCH] Accounted for empty cells --- JavaScript Files/Getting the opening time.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/JavaScript Files/Getting the opening time.js b/JavaScript Files/Getting the opening time.js index 5628902..deb8786 100644 --- a/JavaScript Files/Getting the opening time.js +++ b/JavaScript Files/Getting the opening time.js @@ -17,8 +17,14 @@ Qualtrics.SurveyEngine.addOnReady(function () { tot = []; for (j = 0; j < 2; j++) { m = i * 2 + j; - t = input_boxes[m].value.split(":"); - timing = Number(t[0]) * 60 + Number(t[1]); + t = input_boxes[m].value; + if(t.includes(":")){ + t = t.split(":"); + timing = Number(t[0]) * 60 + Number(t[1]); + } else{ + timing = Number(t) * 60; + } + tot.push(timing); } open_for.push(tot[1] - tot[0]); @@ -31,7 +37,6 @@ Qualtrics.SurveyEngine.addOnReady(function () { if(open_mins){ open_text += " and " + open_mins + " minutes"; } - Qualtrics.SurveyEngine.setEmbeddedData("hours_open", open_text); } });