Skip to content

Commit

Permalink
Accounted for empty cells
Browse files Browse the repository at this point in the history
  • Loading branch information
tafakkur committed Jan 13, 2021
1 parent 6694bb7 commit e4121ad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions JavaScript Files/Getting the opening time.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -31,7 +37,6 @@ Qualtrics.SurveyEngine.addOnReady(function () {
if(open_mins){
open_text += " and " + open_mins + " minutes";
}

Qualtrics.SurveyEngine.setEmbeddedData("hours_open", open_text);
}
});

0 comments on commit e4121ad

Please sign in to comment.