Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
5725a345
Commit
5725a345
authored
7 months ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
refactor: move logic for finding the fallback show
parent
63107926
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!57
Incorporate feedback for virtual timeslots
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/services.py
+14
-7
14 additions, 7 deletions
program/services.py
with
14 additions
and
7 deletions
program/services.py
+
14
−
7
View file @
5725a345
...
@@ -700,6 +700,17 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
...
@@ -700,6 +700,17 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
return
conflicts
return
conflicts
def
get_fallback_show
(
raise_exceptions
:
bool
=
False
):
radio_settings
:
RadioSettings
|
None
=
RadioSettings
.
objects
.
first
()
fallback_show
=
radio_settings
.
fallback_show
if
radio_settings
is
not
None
else
None
if
raise_exceptions
and
fallback_show
is
None
:
raise
ConfigurationError
(
"
Radio settings must define a fallback show if include_virtual is True.
"
,
code
=
"
no-fallback-show-defined
"
,
)
return
fallback_show
def
generate_program_entries
(
def
generate_program_entries
(
queryset
:
QuerySet
[
TimeSlot
],
queryset
:
QuerySet
[
TimeSlot
],
*
,
*
,
...
@@ -743,13 +754,9 @@ def generate_program_entries(
...
@@ -743,13 +754,9 @@ def generate_program_entries(
yield
from
(
create_timeslot_entry
(
timeslot
)
for
timeslot
in
queryset
)
yield
from
(
create_timeslot_entry
(
timeslot
)
for
timeslot
in
queryset
)
return
return
radio_settings
:
RadioSettings
|
None
=
RadioSettings
.
objects
.
first
()
# Program entries that are not based on scheduled timeslots are generated using the fallback
fallback_show
=
radio_settings
.
fallback_show
if
radio_settings
is
not
None
else
None
# show. We can only create these program entries if a fallback show has been specified.
if
fallback_show
is
None
:
fallback_show
=
get_fallback_show
(
raise_exceptions
=
True
)
raise
ConfigurationError
(
"
Radio settings must define a fallback show if include_virtual is True.
"
,
code
=
"
no-fallback-show-defined
"
,
)
entry_start
=
start
entry_start
=
start
timeslot
:
TimeSlot
timeslot
:
TimeSlot
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment