Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically Configure Video When Video is created by an Event #432

Open
wants to merge 13 commits into
base: development
Choose a base branch
from

Conversation

odkhang
Copy link
Collaborator

@odkhang odkhang commented Nov 13, 2024

This PR resolves #431
While creating Event, if Organizer choose Add video, will automatic setup video plugin for current Event.

Summary by Sourcery

Automatically configure the video plugin for events when a video is created, enhancing the video creation process with improved error handling and logging.

New Features:

  • Automatically configure video plugin for events when a video is created.

Enhancements:

  • Improve error handling and logging for video creation process.

Copy link

sourcery-ai bot commented Nov 13, 2024

Reviewer's Guide by Sourcery

This PR implements automatic video configuration when creating an event with video functionality. The implementation adds new functions to handle video plugin setup, improves error handling, and refactors the event creation process to better handle video-related settings.

Sequence diagram for video plugin setup during event creation

sequenceDiagram
    actor Organizer
    participant EventForm
    participant VideoService
    participant PluginManager
    participant EventDatabase

    Organizer->>EventForm: Submit event creation form
    EventForm->>EventForm: Check video creation permission
    alt Has permission
        EventForm->>VideoService: Create video world
        VideoService->>PluginManager: Setup video plugin
        PluginManager->>EventDatabase: Attach plugin to event
        PluginManager->>EventDatabase: Save video settings
        EventDatabase-->>EventForm: Confirmation
        EventForm-->>Organizer: Success message
    else No permission
        EventForm-->>Organizer: Error message
    end
Loading

File-Level Changes

Change Details Files
Added new video plugin setup functionality
  • Created setup_video_plugin function to configure video settings for events
  • Added save_video_settings_information function to persist video configuration
  • Implemented get_installed_plugin function to check plugin availability
  • Added attach_plugin_to_event function to connect plugins with events
  • Created add_plugin helper function to manage plugin lists
src/pretix/eventyay_common/tasks.py
Enhanced error handling and response management in video creation process
  • Improved error handling for various request exceptions
  • Added proper error logging for configuration failures
  • Added validation for video settings
  • Implemented better exception handling with retry mechanisms
src/pretix/eventyay_common/tasks.py
Refactored event creation and video handling logic
  • Restructured handle_video_creation method for better flow control
  • Added permission checking before video creation
  • Improved form processing and validation
  • Added check for form changes before processing
  • Enhanced success/error message handling
src/pretix/eventyay_common/views/event.py

Assessment against linked issues

Issue Objective Addressed Explanation
#431 Automatically set up video plugin when organizer chooses to add video during event creation

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@odkhang odkhang marked this pull request as ready for review November 18, 2024 10:03
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @odkhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider wrapping the video plugin setup within the same transaction as the event creation to maintain data consistency. Currently, if video setup fails after event creation, it could leave the system in an inconsistent state.
  • The retry mechanism in create_world() should implement an exponential backoff strategy to prevent overwhelming the video server during outages.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/pretix/eventyay_common/tasks.py Outdated Show resolved Hide resolved
src/pretix/eventyay_common/tasks.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eventyay-common: Auto setup Video plugin during Event creation
1 participant