ai sql seed waveforms [OC]

    by Original_Building800

    1 Comment

    1. Original_Building800 on

      source: ai written code

      `# Seed data for fasting_periods`

      `fasting_periods = []`

      `# Starting from 30 days ago`

      `current_time = datetime.now() – timedelta(days=30)`

      `for _ in range(30):`

      `# Fasting period: 20:00 to 12:00 next day (16 hours fasting)`

      `fasting_start = current_time.replace(hour=20, minute=0, second=0, microsecond=0)`

      `fasting_end = (fasting_start + timedelta(hours=16)).replace(microsecond=0)`

      `fasting_periods.append({`

      `’id’: str(uuid.uuid4()),`

      `’user_fasting_plan_id’: user_fasting_plan_id,`

      `’start_time’: fasting_start.isoformat(),`

      `’end_time’: fasting_end.isoformat(),`

      `’period_type’: ‘fasting’ # ENUM compliant`

      `})`

      `# Eating period: 12:00 to 20:00 same day (8 hours eating)`

      `eating_start = fasting_end`

      `eating_end = (eating_start + timedelta(hours=8)).replace(microsecond=0)`

      `fasting_periods.append({`

      `’id’: str(uuid.uuid4()),`

      `’user_fasting_plan_id’: user_fasting_plan_id,`

      `’start_time’: eating_start.isoformat(),`

      `’end_time’: eating_end.isoformat(),`

      `’period_type’: ‘eating’ # ENUM compliant`

      `})`

      `# Move to next day`

      `current_time = eating_end + timedelta(seconds=1) # Ensures no overlap`

    Leave A Reply