feat(events): reliable holiday skipping for recurrences + UI badge; clean logs

Backend: generate EventException on create/update when skip_holidays or recurrence changes; emit RecurrenceException (EXDATE) with exact occurrence start time (UTC)
API: return master events with RecurrenceRule + RecurrenceException
Frontend: map RecurrenceException → recurrenceException; ensure SkipHolidays instances never render on holidays; place TentTree icon (black) next to main event icon via template
Docs: update README and Copilot instructions for recurrence/holiday behavior
Cleanup: remove dataSource and debug console logs
This commit is contained in:
RobbStarkAustria
2025-10-12 12:00:43 +00:00
parent 7ab4ea14c4
commit 773628c324
15 changed files with 698 additions and 122 deletions

View File

@@ -0,0 +1,26 @@
"""add skip_holidays to events
Revision ID: 12ab34cd56ef
Revises: 2b627d0885c3
Create Date: 2025-10-12
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '12ab34cd56ef'
down_revision = '2b627d0885c3'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('events', sa.Column('skip_holidays', sa.Boolean(), nullable=False, server_default=sa.text('0')))
# Optional: create index if queries need it
# op.create_index('ix_events_skip_holidays', 'events', ['skip_holidays'])
def downgrade():
# Optional: drop index
# op.drop_index('ix_events_skip_holidays', table_name='events')
op.drop_column('events', 'skip_holidays')

View File

@@ -0,0 +1,61 @@
"""Add recurrence fields to events and event_exceptions table
Revision ID: 15c357c0cf31
Revises: b5a6c3d4e7f8
Create Date: 2025-10-12 05:24:43.936743
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '15c357c0cf31'
down_revision: Union[str, None] = 'b5a6c3d4e7f8'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('event_exceptions',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('event_id', sa.Integer(), nullable=False),
sa.Column('exception_date', sa.Date(), nullable=False),
sa.Column('is_skipped', sa.Boolean(), nullable=False),
sa.Column('override_title', sa.String(length=100), nullable=True),
sa.Column('override_description', sa.Text(), nullable=True),
sa.Column('override_start', sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column('override_end', sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
sa.ForeignKeyConstraint(['event_id'], ['events.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_event_exceptions_event_id'), 'event_exceptions', ['event_id'], unique=False)
op.create_index(op.f('ix_event_exceptions_exception_date'), 'event_exceptions', ['exception_date'], unique=False)
op.drop_index(op.f('ix_conv_source_event_media_id'), table_name='conversions')
op.create_index(op.f('ix_conversions_source_event_media_id'), 'conversions', ['source_event_media_id'], unique=False)
op.add_column('events', sa.Column('recurrence_rule', sa.String(length=255), nullable=True))
op.add_column('events', sa.Column('recurrence_end', sa.TIMESTAMP(timezone=True), nullable=True))
op.create_index(op.f('ix_events_recurrence_end'), 'events', ['recurrence_end'], unique=False)
op.create_index(op.f('ix_events_recurrence_rule'), 'events', ['recurrence_rule'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_events_recurrence_rule'), table_name='events')
op.drop_index(op.f('ix_events_recurrence_end'), table_name='events')
op.drop_column('events', 'recurrence_end')
op.drop_column('events', 'recurrence_rule')
op.drop_index(op.f('ix_conversions_source_event_media_id'), table_name='conversions')
op.create_index(op.f('ix_conv_source_event_media_id'), 'conversions', ['source_event_media_id'], unique=False)
op.drop_index(op.f('ix_event_exceptions_exception_date'), table_name='event_exceptions')
op.drop_index(op.f('ix_event_exceptions_event_id'), table_name='event_exceptions')
op.drop_table('event_exceptions')
# ### end Alembic commands ###