Skip to content

Commit

Permalink
Prevent queued experiment from being selected as most recent
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed May 9, 2023
1 parent 3eb2bf7 commit 8bcaa89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion extension/src/experiments/model/status/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,16 @@ describe('collectFinishedRunningExperiments', () => {
expect(finishedRunning).toStrictEqual({})
})

it('should return the most recently created and unseen (without a status) experiment if there is no longer an experiment running in the workspace', () => {
it('should return the most recently created and unseen and unqueued (without a status) experiment if there is no longer an experiment running in the workspace', () => {
const latestCreatedId = 'exp-123'
const finishedRunning = collectFinishedRunningExperiments(
{},
[
{
Created: '2023-12-01T10:48:24',
id: 'exp-queued',
status: ExperimentStatus.QUEUED
},
{ Created: '2022-12-02T10:48:24', id: 'exp-456' },
{ Created: '2022-10-02T07:48:24', id: 'exp-789' },
{ Created: '2022-12-02T07:48:25', id: latestCreatedId },
Expand Down
4 changes: 3 additions & 1 deletion extension/src/experiments/model/status/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ const getMostRecentExperiment = (
coloredStatus: ColoredStatus
): Experiment | undefined =>
experiments
.filter(({ id }) => coloredStatus[id] === undefined)
.filter(
({ id, status }) => coloredStatus[id] === undefined && !isQueued(status)
)
.sort(({ Created: aCreated }, { Created: bCreated }) => {
if (!aCreated) {
return 1
Expand Down

0 comments on commit 8bcaa89

Please sign in to comment.