Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const VERSION = '1.6.1'
export const VERSION = '1.6.2'

export const RequiredVersions = {
controller: VERSION,
Expand Down
17 changes: 13 additions & 4 deletions app/routes/days.add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
)
})
}

Expand Down
6 changes: 4 additions & 2 deletions app/routes/schedule._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -116,7 +116,9 @@ const Schedule = () => {
</td>
<td className="text-center">{zone.name}</td>
<td className="text-center">
{(JSON.parse(audioSequence) as string[]).length}
{audioSequence === ''
? 0
: (JSON.parse(audioSequence) as string[]).length}
</td>
<td className="text-center">
<form method="post" action={`/schedule/${id}/delete`}>
Expand Down
Loading