From 0d63a52299a4a46a7b60ed166f5e4bfc04b7e5fb Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:35:46 -0400 Subject: [PATCH 01/19] added form settings component to forms/create page --- apps/form-builder/src/app/forms/create/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/form-builder/src/app/forms/create/page.tsx b/apps/form-builder/src/app/forms/create/page.tsx index 7a6911b..42f44fe 100644 --- a/apps/form-builder/src/app/forms/create/page.tsx +++ b/apps/form-builder/src/app/forms/create/page.tsx @@ -1,3 +1,5 @@ +import FormSettings from '@/components/FormSettings'; + export default async function NewFormPage() { - return

New form page

; + return ; } From 889fdeb338d9fe690c0580d99ce90726ab6f524c Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:02:17 -0400 Subject: [PATCH 02/19] added upsert form component to forms/create --- apps/form-builder/src/app/forms/create/page.tsx | 9 ++++++++- apps/form-builder/src/components/FormTabs/index.tsx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/form-builder/src/app/forms/create/page.tsx b/apps/form-builder/src/app/forms/create/page.tsx index 42f44fe..71a10a8 100644 --- a/apps/form-builder/src/app/forms/create/page.tsx +++ b/apps/form-builder/src/app/forms/create/page.tsx @@ -1,5 +1,12 @@ import FormSettings from '@/components/FormSettings'; +import UpsertForm from '@/components/UpsertForm/UpsertForm'; +import { Box } from '@mui/material'; export default async function NewFormPage() { - return ; + return ( + + + + + ); } diff --git a/apps/form-builder/src/components/FormTabs/index.tsx b/apps/form-builder/src/components/FormTabs/index.tsx index 3dd8286..4fab6ef 100644 --- a/apps/form-builder/src/components/FormTabs/index.tsx +++ b/apps/form-builder/src/components/FormTabs/index.tsx @@ -1,5 +1,5 @@ 'use client'; -import { Box, Tabs, Tab, Button, Typography } from '@mui/material'; +import { Box, Tabs, Tab, Button } from '@mui/material'; import React from 'react'; import FormSubmissionTable from '../FormSubmissions/FormSubmissionTable'; import { FormResponse } from '@hack4impact-utk/internal-models'; From ccdb6ae7263203d17cef0b891d2f56399cbfae82 Mon Sep 17 00:00:00 2001 From: Andrew Rutter Date: Sat, 27 Apr 2024 17:21:50 -0400 Subject: [PATCH 03/19] FormQuestions component --- .../src/components/FormQuestions/index.tsx | 36 +++++++++++++++++++ .../src/components/FormTabs/index.tsx | 14 +++++--- 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 apps/form-builder/src/components/FormQuestions/index.tsx diff --git a/apps/form-builder/src/components/FormQuestions/index.tsx b/apps/form-builder/src/components/FormQuestions/index.tsx new file mode 100644 index 0000000..1ce55fb --- /dev/null +++ b/apps/form-builder/src/components/FormQuestions/index.tsx @@ -0,0 +1,36 @@ +'use client'; +import AddIcon from '@mui/icons-material/Add'; +import { Box, Divider, IconButton, Typography } from '@mui/material'; +import React, { useState } from 'react'; +import CreateFormQuestion from '../CreateFormQuestion'; +import { CreateFormQuestionRequest } from '@hack4impact-utk/internal-models'; + +export default function FormQuestions() { + const [questions, setQuestions] = useState([]); + function addFormQuestion() { + const newQuestion: CreateFormQuestionRequest = { + isRequired: false, + questionType: 'Text', + title: '', + description: '', + }; + setQuestions((currQuestions) => [...currQuestions, newQuestion]); + } + return ( + + {questions.map((question, i) => ( + + Question {i + 1} + + + + ))} + + Add new question + + + + + + ); +} diff --git a/apps/form-builder/src/components/FormTabs/index.tsx b/apps/form-builder/src/components/FormTabs/index.tsx index 4fab6ef..ab7b5e5 100644 --- a/apps/form-builder/src/components/FormTabs/index.tsx +++ b/apps/form-builder/src/components/FormTabs/index.tsx @@ -3,8 +3,10 @@ import { Box, Tabs, Tab, Button } from '@mui/material'; import React from 'react'; import FormSubmissionTable from '../FormSubmissions/FormSubmissionTable'; import { FormResponse } from '@hack4impact-utk/internal-models'; +import FormSettings from '../FormSettings'; +import FormQuestions from '../FormQuestions'; -interface formsProp { +interface FormTabsProps { form: FormResponse; } @@ -29,7 +31,7 @@ function CustomTabPanel(props: TabPanelProps) { ); } -export default function FormTabs(props: formsProp) { +export default function FormTabs(props: FormTabsProps) { const [value, setValue] = React.useState(0); const handleChange = (event: React.SyntheticEvent, newValue: number) => { setValue(newValue); @@ -52,8 +54,12 @@ export default function FormTabs(props: formsProp) { > - - + + + + + + + + + ); +} diff --git a/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts b/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts index 2258010..23158c2 100644 --- a/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts +++ b/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts @@ -52,7 +52,6 @@ export const FormQuestionSchema = new Schema( }, supportedFileTypes: { type: Schema.Types.String, - enum: fileTypes, required: true, }, }, @@ -71,7 +70,6 @@ export const FormQuestionSchema = new Schema( }, choiceType: { type: Schema.Types.String, - enum: multipleChoiceTypes, required: true, }, }, From bf33430528de3b72acef598d9cbff0c6af1bc34e Mon Sep 17 00:00:00 2001 From: Andrew Rutter Date: Mon, 29 Apr 2024 18:19:15 -0400 Subject: [PATCH 11/19] suppress warning --- .../FormSubmissions/BarGraphAnalytics/Index.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx b/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx index 5f674b7..b5b8a72 100644 --- a/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx +++ b/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx @@ -13,8 +13,9 @@ interface Props { } export default function BarGraphAnalytics({ choices, answers }: Props) { - // Initialize an object to store the counts of each choice, including "Other" - const choiceCounts: any = { Other: 0 }; + // Initialize an object to store the counts of each choice, including "other" + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const choiceCounts: any = { other: 0 }; // Loop through each choice, create a key for it in the object, and initialize its count to 0 choices.forEach((choice) => { @@ -28,13 +29,13 @@ export default function BarGraphAnalytics({ choices, answers }: Props) { if (choiceCounts.hasOwnProperty(answer)) { choiceCounts[answer]++; } else { - // Increment the count for "Other" - choiceCounts['Other']++; + // Increment the count for "other" + choiceCounts['other']++; } }); }); - // Extract the counts to an array to use as data for the BarChart, including the count for "Other" + // Extract the counts to an array to use as data for the BarChart, including the count for "other" const data = choices.map((choice) => choiceCounts[choice]); // Extract items from answers that are not present in choices @@ -71,9 +72,9 @@ export default function BarGraphAnalytics({ choices, answers }: Props) { > From 7367eec8c85b578a92b873cf9e61a6e720253d17 Mon Sep 17 00:00:00 2001 From: Andrew Rutter Date: Tue, 30 Apr 2024 17:31:06 -0400 Subject: [PATCH 12/19] wip --- .../MultipleChoiceQuestionAnalytics/Index.tsx | 33 ++++++++++++------- .../src/components/FormTabs/index.tsx | 1 - 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx b/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx index dbfcb56..5d126f1 100644 --- a/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx +++ b/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx @@ -38,19 +38,30 @@ export default function MultipleChoiceQuestionAnalytics({ const options = responses[i].questionResponses[num].question.multipleChoiceOptions ?.options; - - // Check if the answer is not in the options array - let answerInOptions = false; - for (let j = 0; j < options!.length; j++) { - if (options![j] === answer) { - answerInOptions = true; - break; + console.log('starting a new response'); + if (Array.isArray(answer)) { + for (const choice of answer) { + console.log(choice, options); + for (let j = 0; j < options!.length; j++) { + if (options?.findIndex((option) => option == choice) === -1) { + array.push(choice); + } + } + } + } else { + // Check if the answer is not in the options array + let answerInOptions = false; + for (let j = 0; j < options!.length; j++) { + if (options![j] == answer) { + answerInOptions = true; + break; + } } - } - // If the answer is not in the options, add it to the array - if (!answerInOptions) { - array.push(answer); + // If the answer is not in the options, add it to the array + if (!answerInOptions) { + array.push(answer); + } } } } diff --git a/apps/form-builder/src/components/FormTabs/index.tsx b/apps/form-builder/src/components/FormTabs/index.tsx index 3b17a41..528891e 100644 --- a/apps/form-builder/src/components/FormTabs/index.tsx +++ b/apps/form-builder/src/components/FormTabs/index.tsx @@ -40,7 +40,6 @@ export default function FormTabs(props: FormTabsProps) { const handleChange = (event: React.SyntheticEvent, newValue: number) => { setValue(newValue); }; - return ( <> From ef3d499f97a2d0eb29901fed65c955914bf087fe Mon Sep 17 00:00:00 2001 From: Andrew Rutter Date: Thu, 2 May 2024 02:43:37 -0400 Subject: [PATCH 13/19] many many good good changes --- .../MultipleChoiceQuestionAnalytics/Index.tsx | 55 ++++++++++++------- .../FormSubmissions/PieChartAnalytics.tsx | 27 +++++---- .../src/db/models/FormBuilder/FormQuestion.ts | 1 - 3 files changed, 51 insertions(+), 32 deletions(-) diff --git a/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx b/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx index dbfcb56..8e5d99a 100644 --- a/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx +++ b/apps/form-builder/src/components/FormSubmissions/MultipleChoiceQuestionAnalytics/Index.tsx @@ -10,6 +10,8 @@ import { ListItemText, Typography, } from '@mui/material'; +import PieChartAnalytics from '../PieChartAnalytics'; +import BarGraphAnalytics from '../BarGraphAnalytics/Index'; // Takes in the question and response as props interface Props { @@ -24,12 +26,14 @@ export default function MultipleChoiceQuestionAnalytics({ }: Props) { // Gets the specific submission to a question from each response from a single form function getAnswers() { - const array = []; + const otherAnswers = []; + const allAnswers: string[] = []; // For a given form, the findIndex function will find the specific question from the list of questionResponses for (let i = 0; i < responses.length; i++) { const num = responses[i].questionResponses.findIndex( (element) => element.question._id.toString() === question._id.toString() ); + console.log(num); if (num === -1) { continue; } else { @@ -38,6 +42,7 @@ export default function MultipleChoiceQuestionAnalytics({ const options = responses[i].questionResponses[num].question.multipleChoiceOptions ?.options; + allAnswers.push(answer as string); // Check if the answer is not in the options array let answerInOptions = false; @@ -50,31 +55,43 @@ export default function MultipleChoiceQuestionAnalytics({ // If the answer is not in the options, add it to the array if (!answerInOptions) { - array.push(answer); + otherAnswers.push(answer); } } } - return array; + return [otherAnswers, allAnswers]; } - + const qType = question.multipleChoiceOptions!.choiceType; // Displays the submissions in a list format with scroll functionality return ( <> - - {'Choice Type: '} - {question.multipleChoiceOptions?.choiceType} - - - - {getAnswers().map((submission, index) => ( - - - {submission} - - - ))} - - + {`${qType} Select`} + {qType === 'Single' && ( + + )} + {qType === 'Multiple' && ( + + )} + {question.multipleChoiceOptions!.allowOther && qType !== 'Multiple' && ( + + {'"Other"'} Answers: + + {getAnswers()[0].map((submission, index) => ( + + + {submission} + + + ))} + + + )} ); } diff --git a/apps/form-builder/src/components/FormSubmissions/PieChartAnalytics.tsx b/apps/form-builder/src/components/FormSubmissions/PieChartAnalytics.tsx index aac6ff9..82b0e1f 100644 --- a/apps/form-builder/src/components/FormSubmissions/PieChartAnalytics.tsx +++ b/apps/form-builder/src/components/FormSubmissions/PieChartAnalytics.tsx @@ -4,7 +4,7 @@ import React from 'react'; interface Props { choices: string[]; - answers: string[][]; + answers: string[]; } //Function to display pie chart @@ -20,19 +20,21 @@ export default function PieChartAnalytics({ choices, answers }: Props) { let totalAnswers = 0; // Loop through each answer and count the occurrences of each choice - answers.forEach((answerSet) => { - answerSet.forEach((answer) => { - // Check if the answer is one of the choices - if (choiceCounts.hasOwnProperty(answer)) { - choiceCounts[answer]++; - } else { - // Increment the count for "Other" - choiceCounts['Other']++; - } - totalAnswers++; - }); + answers.forEach((answer) => { + // Check if the answer is one of the choices + if (choiceCounts.hasOwnProperty(answer)) { + choiceCounts[answer]++; + } else { + // Increment the count for "Other" + choiceCounts['Other']++; + } + totalAnswers++; }); + if (choiceCounts['Other'] === 0) { + delete choiceCounts['Other']; + } + // Extract the counts to an array to use as data for the BarChart, including the count for "Other" const data = Object.keys(choiceCounts).map((key) => ({ label: key, @@ -62,6 +64,7 @@ export default function PieChartAnalytics({ choices, answers }: Props) { }} //Changes size of pie chart height={600} + width={500} /> ); } diff --git a/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts b/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts index 2258010..74a723a 100644 --- a/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts +++ b/packages/internal-models/src/db/models/FormBuilder/FormQuestion.ts @@ -71,7 +71,6 @@ export const FormQuestionSchema = new Schema( }, choiceType: { type: Schema.Types.String, - enum: multipleChoiceTypes, required: true, }, }, From 69298825dd60b3de4c9607b5cd9b60d8b20ed8f1 Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 2 May 2024 16:34:53 -0400 Subject: [PATCH 14/19] 1 responses -> 1 response --- .../src/components/FormAnalytics/index.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/form-builder/src/components/FormAnalytics/index.tsx b/apps/form-builder/src/components/FormAnalytics/index.tsx index 91721a1..dd1353a 100644 --- a/apps/form-builder/src/components/FormAnalytics/index.tsx +++ b/apps/form-builder/src/components/FormAnalytics/index.tsx @@ -34,7 +34,18 @@ export default function FormAnalytics(props: FormAnalyticsProps) { {props.question.title} - {props.responses.reduce(numAnswers, 0)} Responses + + {props.responses.reduce(numAnswers, 0) === 1 && ( + + {props.responses.reduce(numAnswers, 0)} Response + + )} + {props.responses.reduce(numAnswers, 0) > 1 && ( + + {props.responses.reduce(numAnswers, 0)} Responses + + )} + {questionType === 'Text' && ( Date: Thu, 2 May 2024 16:44:57 -0400 Subject: [PATCH 15/19] tolocaledate string on form/[formId] page --- apps/form-builder/src/app/forms/[formId]/page.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/form-builder/src/app/forms/[formId]/page.tsx b/apps/form-builder/src/app/forms/[formId]/page.tsx index 82dd6f0..f28f2ed 100644 --- a/apps/form-builder/src/app/forms/[formId]/page.tsx +++ b/apps/form-builder/src/app/forms/[formId]/page.tsx @@ -2,7 +2,6 @@ import { getFormById } from '@/server/actions/forms'; import * as React from 'react'; import FormTabs from '@/components/FormTabs'; import { Typography } from '@mui/material'; - export default async function FormPage({ params, }: { @@ -14,6 +13,9 @@ export default async function FormPage({ return; } + const updatedAtDate: Date = new Date(form.updatedAt); + const createdAtDate: Date = new Date(form.createdAt); + return (
{/* display properties of a form */} @@ -26,10 +28,10 @@ export default async function FormPage({ Anonymous: {form.isAnonymous.toLocaleString()} - Created At: {form.createdAt.toLocaleString()} + Created At: {createdAtDate.toLocaleString()} - Updated At: {form.updatedAt.toLocaleString()} + Updated At: {updatedAtDate.toLocaleString()} {/* //added tabs and a button */} From 4ba4e15bf4b928f9138e35c35bf892ec09747fae Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 2 May 2024 16:45:46 -0400 Subject: [PATCH 16/19] fixed wording --- apps/form-builder/src/app/forms/[formId]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/form-builder/src/app/forms/[formId]/page.tsx b/apps/form-builder/src/app/forms/[formId]/page.tsx index f28f2ed..01163ec 100644 --- a/apps/form-builder/src/app/forms/[formId]/page.tsx +++ b/apps/form-builder/src/app/forms/[formId]/page.tsx @@ -31,7 +31,7 @@ export default async function FormPage({ Created At: {createdAtDate.toLocaleString()} - Updated At: {updatedAtDate.toLocaleString()} + Last Updated At: {updatedAtDate.toLocaleString()} {/* //added tabs and a button */} From aab00d31b99e057d11a49927829010e60b822cef Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 2 May 2024 17:28:20 -0400 Subject: [PATCH 17/19] added form question type options --- .../FileUploadOptions/FileUploadOptions.tsx | 42 +++++++++++++++ .../src/components/FormQuestionForm/index.tsx | 52 ++++++++++++++++++- .../{ => NumericOptions}/NumericOptions.tsx | 0 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx rename apps/form-builder/src/components/{ => NumericOptions}/NumericOptions.tsx (100%) diff --git a/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx b/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx new file mode 100644 index 0000000..c0012b3 --- /dev/null +++ b/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx @@ -0,0 +1,42 @@ +import { + Box, + FormControl, + InputLabel, + MenuItem, + Select, + SelectChangeEvent, + TextField, +} from '@mui/material'; +import React from 'react'; + +export default function FileUploadOptions() { + const [value, setValue] = React.useState('KB'); + + const handleChange = (event: SelectChangeEvent) => { + setValue(event.target.value); + }; + + return ( + + + + + + + File Size + + + + ); +} diff --git a/apps/form-builder/src/components/FormQuestionForm/index.tsx b/apps/form-builder/src/components/FormQuestionForm/index.tsx index ddd5878..0483967 100644 --- a/apps/form-builder/src/components/FormQuestionForm/index.tsx +++ b/apps/form-builder/src/components/FormQuestionForm/index.tsx @@ -1,5 +1,20 @@ 'use client'; -import { Box, FormControlLabel, Switch, TextField } from '@mui/material'; +import { + Box, + FormControl, + FormControlLabel, + InputLabel, + MenuItem, + Select, + SelectChangeEvent, + Switch, + TextField, +} from '@mui/material'; +import React from 'react'; +import MultipleChoiceOptions from '../MultipleChoiceOptions'; +import TextOptions from '../TextOptions'; +import NumericOptions from '../NumericOptions/NumericOptions'; +import FileUploadOptions from '../FileUploadOptions/FileUploadOptions'; export interface FormQuestionFormData { title: string; @@ -16,6 +31,15 @@ export default function FormQuestionForm({ formData, onChange, }: CreateFormQuestionProps) { + const [value, setValue] = React.useState(''); + + const [questionSettings, setQuestionSettings] = React.useState(''); + + const handleChange = (event: SelectChangeEvent) => { + setValue(event.target.value); + setQuestionSettings(event.target.value); + }; + return ( + + Question Type + + + + {questionSettings === 'Multiple' && ( + + )} + {questionSettings === 'Numeric' && } + {questionSettings === 'Text' && } + {questionSettings === 'FileUpload' && ( + + )} + ); } diff --git a/apps/form-builder/src/components/NumericOptions.tsx b/apps/form-builder/src/components/NumericOptions/NumericOptions.tsx similarity index 100% rename from apps/form-builder/src/components/NumericOptions.tsx rename to apps/form-builder/src/components/NumericOptions/NumericOptions.tsx From 8fa0c497c784ab8cdd4060c2190d480a2b0e1a9e Mon Sep 17 00:00:00 2001 From: Laura Smith <113145914+LSmith2174@users.noreply.github.com> Date: Thu, 2 May 2024 17:46:53 -0400 Subject: [PATCH 18/19] added file type options --- .../FileUploadOptions/FileUploadOptions.tsx | 90 +++++++++++++++---- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx b/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx index c0012b3..56dcd60 100644 --- a/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx +++ b/apps/form-builder/src/components/FileUploadOptions/FileUploadOptions.tsx @@ -1,8 +1,11 @@ import { Box, + Checkbox, FormControl, InputLabel, + ListItemText, MenuItem, + OutlinedInput, Select, SelectChangeEvent, TextField, @@ -16,27 +19,76 @@ export default function FileUploadOptions() { setValue(event.target.value); }; + const fileTypes = [ + 'PDF', + 'TXT', + 'DOC/DOCX', + 'XLS', + 'XLSX', + 'HTML', + 'PPT/PPTX', + 'JPEG', + 'PNG', + 'GIF', + 'MP4', + 'AVI', + 'MOV', + 'MP3', + ]; + + const [fileType, setFileType] = React.useState([]); + + const handleFileChange = (event: SelectChangeEvent) => { + const { + target: { value }, + } = event; + setFileType(typeof value === 'string' ? value.split(',') : value); + }; + return ( - - - - + + + + File Type + + + + + + + - - File Size - - + + File Size + + + ); } From 88e33418c10135d388608cae3eb1bbdf904c39d9 Mon Sep 17 00:00:00 2001 From: Andrew Rutter Date: Thu, 2 May 2024 18:04:07 -0400 Subject: [PATCH 19/19] Revert "suppress warning" This reverts commit bf33430528de3b72acef598d9cbff0c6af1bc34e. --- .../FormSubmissions/BarGraphAnalytics/Index.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx b/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx index b5b8a72..5f674b7 100644 --- a/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx +++ b/apps/form-builder/src/components/FormSubmissions/BarGraphAnalytics/Index.tsx @@ -13,9 +13,8 @@ interface Props { } export default function BarGraphAnalytics({ choices, answers }: Props) { - // Initialize an object to store the counts of each choice, including "other" - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const choiceCounts: any = { other: 0 }; + // Initialize an object to store the counts of each choice, including "Other" + const choiceCounts: any = { Other: 0 }; // Loop through each choice, create a key for it in the object, and initialize its count to 0 choices.forEach((choice) => { @@ -29,13 +28,13 @@ export default function BarGraphAnalytics({ choices, answers }: Props) { if (choiceCounts.hasOwnProperty(answer)) { choiceCounts[answer]++; } else { - // Increment the count for "other" - choiceCounts['other']++; + // Increment the count for "Other" + choiceCounts['Other']++; } }); }); - // Extract the counts to an array to use as data for the BarChart, including the count for "other" + // Extract the counts to an array to use as data for the BarChart, including the count for "Other" const data = choices.map((choice) => choiceCounts[choice]); // Extract items from answers that are not present in choices @@ -72,9 +71,9 @@ export default function BarGraphAnalytics({ choices, answers }: Props) { >