Skip to content

Commit

Permalink
🐛 (results) Fix export results when more than 200
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Nov 21, 2022
1 parent fbd3304 commit 8c15fd1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ export const ResultsActionButtons = ({
const getAllTableData = async () => {
if (!workspaceId || !typebotId) return []
const allResults = []
let cursor: string | undefined | null
let cursor: string | undefined
do {
try {
const { results, nextCursor } =
await trpcContext.results.getResults.fetch({
typebotId,
limit: '200',
cursor,
})
allResults.push(...results)
cursor = nextCursor
cursor = nextCursor ?? undefined
} catch (error) {
showToast({ description: (error as TRPCError).message })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ResultsActionButtons } from './ResultsActionButtons'
import { Row } from './Row'
import { HeaderRow } from './HeaderRow'
import { CellValueType, TableData } from '../../types'
import { HeaderIcon } from '../../utils'
import { HeaderIcon, parseAccessor } from '../../utils'
import { IndeterminateCheckbox } from './IndeterminateCheckbox'

type ResultsTableProps = {
Expand Down Expand Up @@ -111,7 +111,7 @@ export const ResultsTable = ({
},
...resultHeader.map<ColumnDef<TableData>>((header) => ({
id: header.id,
accessorKey: header.label,
accessorKey: parseAccessor(header.label),
size: 200,
header: () => (
<HStack overflow="hidden" data-testid={`${header.label} header`}>
Expand All @@ -120,14 +120,9 @@ export const ResultsTable = ({
</HStack>
),
cell: (info) => {
try {
const value = info?.getValue() as CellValueType | undefined
if (!value) return
return value.element || value.plainText || ''
} catch (err) {
console.error(err)
return
}
const value = info?.getValue() as CellValueType | undefined
if (!value) return
return value.element || value.plainText || ''
},
})),
{
Expand Down
10 changes: 6 additions & 4 deletions apps/builder/src/features/results/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const parseDateToReadable = (date: Date): string =>
minute: '2-digit',
})

export const parseSubmissionsColumns = (
export const parseAccessor = (label: string) => label.replaceAll('.', '')

export const parseHeaderCells = (
resultHeader: ResultHeaderCell[]
): HeaderCell[] =>
resultHeader.map((header) => ({
Expand All @@ -30,7 +32,7 @@ export const parseSubmissionsColumns = (
<Text>{header.label}</Text>
</HStack>
),
accessor: header.label,
accessor: parseAccessor(header.label),
}))

export const HeaderIcon = ({ header }: { header: ResultHeaderCell }) =>
Expand Down Expand Up @@ -66,7 +68,7 @@ export const convertResultsToTableData = (
if (!header || !header.blocks || !header.blockType) return o
return {
...o,
[header.label]: {
[parseAccessor(header.label)]: {
element: parseContent(answer.content, header.blockType),
plainText: answer.content,
},
Expand All @@ -80,7 +82,7 @@ export const convertResultsToTableData = (
if (isDefined(o[key])) return o
return {
...o,
[key]: { plainText: variable.value?.toString() },
[parseAccessor(key)]: { plainText: variable.value?.toString() },
}
}, {}),
}))
Expand Down

5 comments on commit 8c15fd1

@vercel
Copy link

@vercel vercel bot commented on 8c15fd1 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2-alpha – ./apps/viewer

ns8.vn
yobot.me
247987.com
8jours.top
bot.aws.bj
bot.bbc.bj
finplex.be
sat.cr8.ai
minipost.uk
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
cares.urlabout.me
fmm.wpwakanda.com
gentleman-shop.fr
k1.kandabrand.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
1988.bouclidom.com
andreimayer.com.br
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
dicanatural.online
goalsettingbot.com
positivobra.com.br
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
bot.digitalbled.com
bot.eventhub.com.au
bot.jepierre.com.br
carsalesenquiry.com
demo.botscientis.us
forms.webisharp.com
kbsub.wpwakanda.com
live.botscientis.us
mentoria.omelhor.vc
nutrisamirbayde.com
order.maitempah.com
quest.wpwakanda.com
test.botscientis.us
typebot.stillio.com
wordsandimagery.com
bium.gratirabbit.com
bot.ansuraniphone.my
bot.cotemeuplano.com
chat.hayurihijab.com
chatbee.agfunnel.com
click.sevenoways.com
connect.growthguy.in
kuiz.sistemniaga.com
offer.botscientis.us
reward.onlinebotdemo.xyz
type.opaulovieira.com.br
aibot.angrybranding.co.uk
bot.aidigitalmarketing.kr
bot.arraesecenteno.com.br
bot.blackboxsports.com.br
bot.cabinrentalagency.com
boyfriend-breakup.riku.ai
brigadeirosemdrama.com.br
chat.ertcrebateportal.com
chat.thisiscrushhouse.com
sellmyharleylouisiana.com
verfica.botmachine.com.br
configurator.bouclidom.com
help.atlasoutfittersk9.com
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
presente.empresarias.com.mx
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
piazzatorre.barrettamario.it
requests.swamprecordsgnv.com
type.cookieacademyonline.com
bot.brigadeirosemdrama.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
yourfeedback.comebackreward.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
viewer-v2-alpha-typebot-io.vercel.app
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
viewer-v2-alpha-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8c15fd1 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 8c15fd1 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8c15fd1 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8c15fd1 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app

Please sign in to comment.