Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
0acc2e47
Commit
0acc2e47
authored
Dec 27, 2023
by
Lucas Brandstaetter
Browse files
Options
Downloads
Patches
Plain Diff
Fix event speaker lists in schedule api
parent
67d1554d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/schedule.py
+8
-9
8 additions, 9 deletions
src/api/schedule.py
src/core/models/events.py
+4
-3
4 additions, 3 deletions
src/core/models/events.py
with
12 additions
and
12 deletions
src/api/schedule.py
+
8
−
9
View file @
0acc2e47
...
@@ -148,17 +148,16 @@ class ScheduleEncoder(json.JSONEncoder):
...
@@ -148,17 +148,16 @@ class ScheduleEncoder(json.JSONEncoder):
def
collect_persons
(
self
,
event
):
def
collect_persons
(
self
,
event
):
persons
=
[]
persons
=
[]
# TODO remove this workaround once imported speakers are stored as participants
# and have links and biography=description
if
event
.
additional_data
and
'
persons
'
in
event
.
additional_data
and
len
(
event
.
additional_data
[
'
persons
'
])
>
0
:
persons
=
event
.
additional_data
[
'
persons
'
]
else
:
if
hasattr
(
event
,
'
speakers
'
):
if
hasattr
(
event
,
'
speakers
'
):
# event is a QuerySet and already fetched speakers
# event is a QuerySet and already fetched speakers
persons
=
list
(
event
.
speakers
)
persons
=
[
speaker
.
participant
for
speaker
in
event
.
speakers
]
else
:
else
:
# direct event lookup -> fetch persons via public_speakers
# direct event lookup -> fetch persons via public_speakers
persons
=
list
(
event
.
public_speakers
)
persons
=
event
.
public_speakers
# TODO remove this workaround once imported speakers are stored as participants
if
event
.
additional_data
and
'
persons
'
in
event
.
additional_data
and
len
(
event
.
additional_data
[
'
persons
'
])
>
0
:
persons
+=
event
.
additional_data
[
'
persons
'
]
return
[
self
.
encode_person
(
person
)
for
person
in
persons
]
return
[
self
.
encode_person
(
person
)
for
person
in
persons
]
...
...
This diff is collapsed.
Click to expand it.
src/core/models/events.py
+
4
−
3
View file @
0acc2e47
...
@@ -223,11 +223,12 @@ class Event(TaggedItemMixin, BackendMixin, models.Model):
...
@@ -223,11 +223,12 @@ class Event(TaggedItemMixin, BackendMixin, models.Model):
return
hub_absolute
(
'
plainui:event
'
,
event_slug
=
self
.
slug
,
i18n
=
False
)
return
hub_absolute
(
'
plainui:event
'
,
event_slug
=
self
.
slug
,
i18n
=
False
)
@property
@property
def
public_speakers
(
self
):
def
public_speakers
(
self
)
->
list
:
"""
Returns a list of all public speakers of this event.
"""
"""
Returns a list of all public speakers of this event.
"""
persons
=
self
.
participants
.
filter
(
is_public
=
True
,
role
=
EventParticipant
.
Role
.
SPEAKER
).
select_related
(
'
participant
'
)
persons
=
self
.
participants
.
filter
(
is_public
=
True
,
role
=
EventParticipant
.
Role
.
SPEAKER
).
values_list
(
'
participant
'
,
flat
=
True
)
if
self
.
kind
==
Event
.
Kind
.
SELF_ORGANIZED
and
self
.
owner
:
# If there is no speaker for an SoS, the owner is automatically added.
if
self
.
kind
==
Event
.
Kind
.
SELF_ORGANIZED
and
not
persons
and
self
.
owner
:
persons
.
add
(
self
.
owner
)
persons
.
add
(
self
.
owner
)
return
persons
return
persons
...
...
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