Enhance scheduling component and improve data handling

- Added conductorsExpanded state to manage the visibility of the conductors list in the scheduling component.
- Updated color assignment logic for conductors to ensure consistent coloring based on their position in the array.
- Modified spawnSingleRepetition function to accept an updated set of selected IDs for accurate stagger calculations.
- Refactored soaking and airdrying data retrieval to map results from a unified experiment_phase_executions table, improving data consistency.
- Enhanced UI for conductor selection, including a collapsible list and improved availability indicators.
This commit is contained in:
salirezav
2025-12-05 11:10:21 -05:00
parent 5d52183d8e
commit 23d20d0ac3
6 changed files with 586 additions and 118 deletions

View File

@@ -842,18 +842,36 @@ export const phaseManagement = {
return null
}
// Get soaking for the first repetition
// Get soaking from unified experiment_phase_executions table
const { data, error } = await supabase
.from('soaking')
.from('experiment_phase_executions')
.select('*')
.eq('repetition_id', repetitions[0].id)
.eq('phase_type', 'soaking')
.single()
if (error) {
if (error.code === 'PGRST116') return null // Not found
throw error
}
return data
// Map unified table data to Soaking interface format
if (data) {
return {
id: data.id,
repetition_id: data.repetition_id,
scheduled_start_time: data.scheduled_start_time,
actual_start_time: data.actual_start_time || null,
soaking_duration_minutes: data.soaking_duration_minutes || 0,
scheduled_end_time: data.scheduled_end_time || '',
actual_end_time: data.actual_end_time || null,
created_at: data.created_at,
updated_at: data.updated_at,
created_by: data.created_by
} as Soaking
}
return null
},
async getSoakingByRepetitionId(repetitionId: string): Promise<Soaking | null> {
@@ -928,18 +946,36 @@ export const phaseManagement = {
return null
}
// Get airdrying for the first repetition
// Get airdrying from unified experiment_phase_executions table
const { data, error } = await supabase
.from('airdrying')
.from('experiment_phase_executions')
.select('*')
.eq('repetition_id', repetitions[0].id)
.eq('phase_type', 'airdrying')
.single()
if (error) {
if (error.code === 'PGRST116') return null // Not found
throw error
}
return data
// Map unified table data to Airdrying interface format
if (data) {
return {
id: data.id,
repetition_id: data.repetition_id,
scheduled_start_time: data.scheduled_start_time,
actual_start_time: data.actual_start_time || null,
duration_minutes: data.duration_minutes || 0,
scheduled_end_time: data.scheduled_end_time || '',
actual_end_time: data.actual_end_time || null,
created_at: data.created_at,
updated_at: data.updated_at,
created_by: data.created_by
} as Airdrying
}
return null
},
async getAirdryingByRepetitionId(repetitionId: string): Promise<Airdrying | null> {