Skip to content

Commit

Permalink
fix unexpected bug (that could be due to using db across different ve…
Browse files Browse the repository at this point in the history
…rsions?)
  • Loading branch information
es92 committed May 3, 2024
1 parent 4a6bee4 commit ab3a1f7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/summarizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,18 @@ const updateSurvey = async (
responses = responseData;
} else {
responses = {};
console.log(responseData);
Object.entries(responseData).forEach(([ username, response ]) => {
let userResponses = JSON.parse(response);
userResponses = userResponses.filter((r) => r != '');
userResponses.forEach((r, i) => {
responses[username + `[${i}]`] = r;
});
try {
let userResponses = JSON.parse(response);
userResponses = userResponses.filter((r) => r != '');
userResponses.forEach((r, i) => {
responses[username + `[${i}]`] = r;
});
} catch(e) {
console.error('error processing multi-response', e);
responses[username] = response;
}
});
}

Expand Down

0 comments on commit ab3a1f7

Please sign in to comment.