Skip to content

Improve external API #7

@russss

Description

@russss

Currently slotmachine accepts a fairly opaque list of dictionaries from the main website:

                export = {
                    "id": proposal.id,
                    "duration": proposal.scheduled_duration,
                    "speakers": [proposal.user.id],
                    "title": proposal.title,
                    "valid_venues": [v.id for v in proposal.get_allowed_venues()],
                    "preferred_venues": preferred_venues,  # This supports a list, but we only want one for now
                    "time_ranges": [
                        {"start": str(p.start), "end": str(p.end)}
                        for p in proposal.get_allowed_time_periods_with_default()
                    ],
                    "preferred_time_ranges": [
                        {"start": str(p.start), "end": str(p.end)}
                        for p in proposal.get_preferred_time_periods_with_default()
                    ],
                    "spacing_slots": spacing_slots,
                }

We should replace this with a class in the Slotmachine package which clearly defines the types of these fields, and documents them usefully.

I don't know if we can do something better with spacing_slots. We could probably move the concept of spacing outside of slotmachine entirely, and just feed it the total duration including changeover times, but I'm not sure if this might be useful for debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions