Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Receipt files missing from data export #6331

Copy link
Copy link
@tomasr8

Description

@tomasr8
Issue body actions

When using the data export feature, registration documents (receipts, etc..) are currently not included

We'd probably just need to extend this function:

def get_registration_files(user):
"""Get all files uploaded in registration file fields."""
return (RegistrationData.query
.join(Registration)
.filter(Registration.user == user,
RegistrationData.filename.isnot(None))
.all())

..and add a new case to the storage path builder:

def build_storage_path(file):
"""Build a path under which a given file be stored in the exported zip file.
The path includes both the id (to ensure uniqueness) and the title/name for
easy navigation.
"""
if isinstance(file, RegistrationData):
event = file.registration.event
prefix = 'registrations'
path = f'{event.id}_{event.title}'
elif isinstance(file, AttachmentFile):
prefix = 'attachments'
path = ''
elif isinstance(file, AbstractFile):
event = file.abstract.event
prefix = 'abstracts'
path = f'{event.id}_{event.title}/{file.abstract.id}_{file.abstract.title}'
elif isinstance(file, PaperFile):
event = file._contribution.event
prefix = 'papers'
path = f'{event.id}_{event.title}/{file._contribution.id}_{file.paper.title}'
else:
editable = file.revision.editable
event = editable.contribution.event
prefix = f'editables/{editable.type.name}'
path = f'{event.id}_{event.title}/{editable.id}_{editable.contribution.title}'
path = secure_path(path)
filename = build_filename(file)
return str(Path() / prefix / path / filename)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.