add scheduling functionality for experiments with new ScheduleModal component

This commit is contained in:
Alireza Vaezi
2025-07-20 21:07:58 -04:00
parent 6797519b0a
commit 4919efb845
5 changed files with 357 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
-- Add scheduled_date field to experiments table
-- This migration adds support for storing when experiments are scheduled to run
-- Add scheduled_date column to experiments table
ALTER TABLE public.experiments
ADD COLUMN IF NOT EXISTS scheduled_date TIMESTAMP WITH TIME ZONE;
-- Create index for better performance when querying by scheduled date
CREATE INDEX IF NOT EXISTS idx_experiments_scheduled_date ON public.experiments(scheduled_date);
-- Add comment for documentation
COMMENT ON COLUMN public.experiments.scheduled_date IS 'Date and time when the experiment is scheduled to run';

60
supabase/seed.sql Normal file
View File

@@ -0,0 +1,60 @@
-- Seed data for testing experiment scheduling functionality
-- Insert some sample experiments for testing
INSERT INTO public.experiments (
experiment_number,
reps_required,
soaking_duration_hr,
air_drying_time_min,
plate_contact_frequency_hz,
throughput_rate_pecans_sec,
crush_amount_in,
entry_exit_height_diff_in,
schedule_status,
results_status,
created_by
) VALUES
(
1001,
5,
2.5,
30,
50.0,
2.5,
0.005,
1.2,
'pending schedule',
'valid',
(SELECT id FROM public.user_profiles WHERE email = 's.alireza.v@gmail.com')
),
(
1002,
3,
1.0,
15,
45.0,
3.0,
0.003,
0.8,
'pending schedule',
'valid',
(SELECT id FROM public.user_profiles WHERE email = 's.alireza.v@gmail.com')
),
(
1003,
4,
3.0,
45,
55.0,
2.0,
0.007,
1.5,
'scheduled',
'valid',
(SELECT id FROM public.user_profiles WHERE email = 's.alireza.v@gmail.com')
);
-- Update one experiment to have a scheduled date for testing
UPDATE public.experiments
SET scheduled_date = NOW() + INTERVAL '2 days'
WHERE experiment_number = 1003;