fix lint issue

This commit is contained in:
KDSBrowne 2022-10-18 14:45:47 +00:00
parent 011a41f6d1
commit 7cc79913f0

View File

@ -84,20 +84,20 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
} = currentSlide;
const questionRegex = /.*?\?$/gm;
let question = content.match(questionRegex) || '';
const question = content.match(questionRegex) || '';
const doubleQuestionRegex = /\?{2}/gm;
let doubleQuestion = content.match(doubleQuestionRegex) || null;
const doubleQuestion = content.match(doubleQuestionRegex) || null;
const pollRegex = /[1-9A-Ia-i][.)].*/g;
let optionsPoll = content.match(pollRegex) || [];
let optionsWithLabels = [];
const optionsWithLabels = [];
if (optionsPoll) {
optionsPoll = optionsPoll.map((opt) => {
const MAX_CHAR_LIMIT = 30;
const formattedOpt = opt.substring(0, MAX_CHAR_LIMIT);
optionsWithLabels.push(formattedOpt);
return `\r${opt[0]}.`
return `\r${opt[0]}.`;
});
}
@ -136,7 +136,8 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
return acc;
}, []).filter(({
options,
}) => options.length > 1 && options.length < 10).forEach((poll) => {
}) => options.length > 1 && options.length < 10).forEach((p) => {
const poll = p;
if (doubleQuestion) poll.multiResp = true;
if (poll.options.length <= 5 || MAX_CUSTOM_FIELDS <= 5) {
const maxAnswer = poll.options.length > MAX_CUSTOM_FIELDS
@ -156,10 +157,10 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
if (question.length > 0 && optionsPoll.length === 0 && !doubleQuestion) {
quickPollOptions.push({
type: `R-`,
type: 'R-',
poll: {
question: question[0],
}
question: question[0],
},
});
}
@ -186,7 +187,7 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
poll,
}));
const pollQuestion = (question?.length > 0 && question[0]?.replace(/ *\([^)]*\) */g, "")) || '';
const pollQuestion = (question?.length > 0 && question[0]?.replace(/ *\([^)]*\) */g, '')) || '';
return {
slideId: currentSlide.id,