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

Implement an organizer customer account and fee system | Task management #452

Draft
wants to merge 5 commits into
base: development
Choose a base branch
from

Conversation

lcduong
Copy link
Contributor

@lcduong lcduong commented Nov 22, 2024

This PR is part of issue #383

Apply django-celery-beat to manage tasks, this PR implement:

  • Migration file to init tasks for billing invoice which listed in this PR Implement schedule task to collect billing invoice #417 (instead of save in settings file, we use django-celery-beat to save in database)
  • /control/admin/task_management for manage all tasks, Admin can view all scheduled tasks in the systems and able to enable/disable it.

image

Summary by Sourcery

Implement a task management system for administrators and refactor billing tasks to use django-celery-beat for scheduling.

New Features:

  • Introduce a task management system for administrators to view and manage scheduled tasks, including enabling and disabling them.

Enhancements:

  • Refactor billing and payment tasks to use database-backed scheduling with django-celery-beat instead of static settings.

Build:

  • Add django_celery_beat and cron-descriptor as dependencies to manage and describe scheduled tasks.

Copy link

sourcery-ai bot commented Nov 22, 2024

Reviewer's Guide by Sourcery

This PR implements task management functionality for billing-related tasks using django-celery-beat. The main changes include moving scheduled tasks from settings to the database, adding a task management UI for administrators, and improving task execution with database transaction handling.

Class diagram for Task Management and Billing System

classDiagram
    class TaskList {
        +template_name
        +context_object_name
        +model
        +filter_form()
        +get_queryset()
        +process_task_data(task)
        +get_context_data()
        +post(request, *args, **kwargs)
    }
    class TaskFilterForm {
        +name
        +status
        +filter_qs(qs)
    }
    class PeriodicTask {
        +name
        +task
        +crontab
    }
    class CrontabSchedule {
        +minute
        +hour
        +day_of_month
        +month_of_year
        +day_of_week
    }
    TaskList --> TaskFilterForm
    TaskList --> PeriodicTask
    PeriodicTask --> CrontabSchedule
    TaskFilterForm --> PeriodicTask
Loading

File-Level Changes

Change Details Files
Implemented database-driven task scheduling using django-celery-beat
  • Added django-celery-beat to project dependencies
  • Created migration to initialize billing-related scheduled tasks
  • Moved task schedules from settings.py to database storage
  • Added database transaction handling with scopes_disabled() for task execution
src/pretix/settings.py
src/pretix/plugins/scheduledtasks/migrations/init_scheduled_tasks.py
src/pretix/eventyay_common/tasks.py
pyproject.toml
Added task management UI for administrators
  • Created new TaskList view for managing scheduled tasks
  • Added task filtering functionality by name and status
  • Implemented task enable/disable toggle functionality
  • Added task management to admin navigation
src/pretix/control/views/admin.py
src/pretix/control/forms/filter.py
src/pretix/control/templates/pretixcontrol/admin/task_management/task_management.html
src/pretix/static/task_management/js/task_management.js
src/pretix/control/navigation.py
src/pretix/control/urls.py

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

@lcduong lcduong marked this pull request as draft November 22, 2024 09:46
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 @lcduong - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 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.

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.

2 participants