|
124 | 124 |
|
125 | 125 | // Wait for table to initialize and set default selections |
126 | 126 | tableExplorer.initialized.then(() => { |
127 | | - // Select last curated group and last 3 CI groups (all seeds in each group) |
| 127 | + // For each algorithm-environment pair, select: |
| 128 | + // - Most recent curated run (if exists) |
| 129 | + // - 3 most recent CI runs (if exist) |
128 | 130 | const allGroups = tableExplorer.groupedRuns; |
129 | | - const curatedGroups = allGroups.filter(g => g.source === 'curated'); |
130 | | - const ciGroups = allGroups.filter(g => g.source === 'ci'); |
131 | 131 |
|
132 | | - // Flatten to get individual runs from selected groups |
133 | | - const defaultGroups = [ |
134 | | - ...(curatedGroups.length > 0 ? [curatedGroups[0]] : []), |
135 | | - ...ciGroups.slice(0, 3) |
136 | | - ]; |
| 132 | + // Group by algorithm-environment pair |
| 133 | + const algoEnvPairs = {}; |
| 134 | + for (const group of allGroups) { |
| 135 | + const key = `${group.algorithm}_${group.environment}`; |
| 136 | + if (!algoEnvPairs[key]) { |
| 137 | + algoEnvPairs[key] = { |
| 138 | + curated: [], |
| 139 | + ci: [] |
| 140 | + }; |
| 141 | + } |
| 142 | + if (group.source === 'curated') { |
| 143 | + algoEnvPairs[key].curated.push(group); |
| 144 | + } else if (group.source === 'ci') { |
| 145 | + algoEnvPairs[key].ci.push(group); |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + // For each pair, select the most recent runs |
| 150 | + const selectedGroups = []; |
| 151 | + for (const [key, groups] of Object.entries(algoEnvPairs)) { |
| 152 | + // Add most recent curated run |
| 153 | + if (groups.curated.length > 0) { |
| 154 | + selectedGroups.push(groups.curated[0]); |
| 155 | + } |
| 156 | + // Add 3 most recent CI runs |
| 157 | + selectedGroups.push(...groups.ci.slice(0, 3)); |
| 158 | + } |
137 | 159 |
|
138 | | - // Extract all individual runs from these groups |
139 | | - const defaultSelections = defaultGroups.flatMap(g => g.runs); |
| 160 | + // Extract all individual runs from selected groups |
| 161 | + const defaultSelections = selectedGroups.flatMap(g => g.runs); |
140 | 162 |
|
141 | 163 | if (defaultSelections.length > 0) { |
142 | 164 | tableExplorer.setSelectedRuns(defaultSelections); |
|
0 commit comments