diff --git a/app/lib/constants.ts b/app/lib/constants.ts index f46ad68..c3ba4dd 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -1,4 +1,4 @@ -export const VERSION = '1.6.1' +export const VERSION = '1.6.2' export const RequiredVersions = { controller: VERSION, diff --git a/app/routes/days.add.tsx b/app/routes/days.add.tsx index 04433f6..da044d8 100644 --- a/app/routes/days.add.tsx +++ b/app/routes/days.add.tsx @@ -62,13 +62,22 @@ export const action = async ({request}: ActionFunctionArgs) => { if (copyFrom !== '-') { const schedules = await prisma.schedule.findMany({ - where: {dayTypeId: copyFrom === '_' ? undefined : copyFrom} + where: {dayTypeId: copyFrom === '_' ? null : copyFrom} }) await prisma.schedule.createMany({ - data: schedules.map(({time, weekDays, zoneId, audioId}) => { - return {dayTypeId: dayType.id, time, weekDays, zoneId, audioId} - }) + data: schedules.map( + ({time, weekDays, zoneId, audioId, audioSequence}) => { + return { + dayTypeId: dayType.id, + time, + weekDays, + zoneId, + audioId, + audioSequence + } + } + ) }) } diff --git a/app/routes/schedule._index.tsx b/app/routes/schedule._index.tsx index b584797..91b822b 100644 --- a/app/routes/schedule._index.tsx +++ b/app/routes/schedule._index.tsx @@ -30,7 +30,7 @@ export const loader = async ({request}: LoaderFunctionArgs) => { const schedules = await prisma.schedule.findMany({ orderBy: {time: 'asc'}, - include: {zone: true, audio: true} + include: {zone: true} }) const days = await prisma.dayType.findMany({ @@ -116,7 +116,9 @@ const Schedule = () => { {zone.name} - {(JSON.parse(audioSequence) as string[]).length} + {audioSequence === '' + ? 0 + : (JSON.parse(audioSequence) as string[]).length}