Skip to content

Commit

Permalink
Add event attendance mode to jsonld
Browse files Browse the repository at this point in the history
  • Loading branch information
vidya-ram committed Nov 29, 2023
1 parent a3c1c88 commit 3c0168a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions funnel/transports/email/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def jsonld_confirm_action(description: str, url: str, title: str) -> dict[str, o
def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]:
"""Schema.org JSON-LD markup for an event reservation."""
location: str | dict[str, object]
event_mode: str
venue = rsvp.project.primary_venue
if venue is not None:
location = {
Expand All @@ -90,11 +91,13 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]:
'addressCountry': venue.country,
}
location['address'] = postal_address
event_mode = "https://schema.org/OfflineEventAttendanceMode"
else:
location = {
"@type": "VirtualLocation",
"url": rsvp.project.absolute_url,
}
event_mode = "https://schema.org/OnlineEventAttendanceMode"
return {
'@context': 'https://schema.org',
'@type': 'EventReservation',
Expand All @@ -106,6 +109,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]:
if rsvp.state.NO
else 'https://schema.org/ReservationPending'
),
"eventAttendanceMode": event_mode,
'underName': {
'@type': 'Person',
'name': rsvp.participant.fullname,
Expand All @@ -122,6 +126,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]:
'image': rsvp.project.account.logo_url
},
},
'modifyReservationUrl': rsvp.project.absolute_url,
'numSeats': '1',
}

Expand Down

0 comments on commit 3c0168a

Please sign in to comment.