Skip to content
Snippets Groups Projects
Commit 69f88292 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

fix: treat media source that are too short as error

refs #351
parent 73cd03ba
No related branches found
No related tags found
No related merge requests found
...@@ -191,14 +191,12 @@ export default { ...@@ -191,14 +191,12 @@ export default {
show: 'Medienquellen von Sendereihe übernommen', show: 'Medienquellen von Sendereihe übernommen',
}, },
state: { state: {
notice: { invalid: {
tooShort: { tooShort: {
title: 'Es ist Sendezeit übrig', title: 'Es ist Sendezeit übrig',
shortLabel: 'Ungenutzte Sendezeit', shortLabel: 'Zu kurz',
description: `Die hinterlegten Medienquellen sind um <strong>%{offset}</strong> kürzer als die Dauer des Sendetermins. Wird die Sendezeit nicht ausgenutzt, übernimmt automatisch das Fallback-Programm.`, description: `Die hinterlegten Medienquellen sind um <strong>%{offset}</strong> kürzer als die Dauer des Sendetermins. Bitte füge weitere Medienquellen hinzu.`,
}, },
},
invalid: {
tooLong: { tooLong: {
title: 'Die Sendezeit ist überschritten', title: 'Die Sendezeit ist überschritten',
shortLabel: 'Zu lang', shortLabel: 'Zu lang',
......
...@@ -191,14 +191,12 @@ export default { ...@@ -191,14 +191,12 @@ export default {
show: 'Media sources inherited from show', show: 'Media sources inherited from show',
}, },
state: { state: {
notice: { invalid: {
tooShort: { tooShort: {
title: 'There is airtime left', title: 'There is airtime left',
shortLabel: 'Unused airtime', shortLabel: 'Too short',
description: `The media sources are <strong>%{offset}</strong> shorter than the duration of the broadcast. If the airtime is not used, the fallback programme automatically takes over.`, description: `The media sources are <strong>%{offset}</strong> shorter than the duration of the broadcast. Please add more media sources.`,
}, },
},
invalid: {
tooLong: { tooLong: {
title: 'The airtime is exceeded', title: 'The airtime is exceeded',
shortLabel: 'Too long', shortLabel: 'Too long',
......
...@@ -114,8 +114,8 @@ type MediaState = ...@@ -114,8 +114,8 @@ type MediaState =
| 'autoExpanded' | 'autoExpanded'
| 'invalid.missing' | 'invalid.missing'
| 'invalid.multipleUnknownDurations' | 'invalid.multipleUnknownDurations'
| 'invalid.tooShort'
| 'invalid.tooLong' | 'invalid.tooLong'
| 'notice.tooShort'
export function useMediaState( export function useMediaState(
media: MaybeRefOrGetter<Media | null>, media: MaybeRefOrGetter<Media | null>,
...@@ -174,7 +174,7 @@ export function useMediaState( ...@@ -174,7 +174,7 @@ export function useMediaState(
// too short, and we have a target duration to reach, the sources won’t fill them entirely. // too short, and we have a target duration to reach, the sources won’t fill them entirely.
if (roundedTargetDuration !== null && staticMediaDuration < roundedTargetDuration) { if (roundedTargetDuration !== null && staticMediaDuration < roundedTargetDuration) {
return { return {
state: 'notice.tooShort', state: 'invalid.tooShort',
durationSeconds: staticMediaDuration, durationSeconds: staticMediaDuration,
offsetSeconds: roundedTargetDuration - staticMediaDuration, offsetSeconds: roundedTargetDuration - staticMediaDuration,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment